An instance of NSDateComponents
can include a calendar. This component was added in iOS 4.0 and OS X 10.7:
iOS Note: In iOS 4.0 and later, NSDateComponents objects can contain a calendar, a timezone, and a date object. This allows date components to be passed to or returned from a method and retain their meaning.
You can pass NSCalendarCalendarUnit
to -[NSCalendar components:fromDate:]
to have it include the calendar in the returned NSDateComponents
.
UPDATE
If you want to compute the number of days between two dates, use -[NSCalendar components:fromDate:toDate:options:]
. You may need to construct the two NSDate
objects first, using dateFromComponents:
.