Monday, May 23, 2011

NSCalendar calendar Units list

Calendar units are a list of bitmask constant that specifies each component of a NSDateComponent object. NSCalendar components:fromDate: method and NSCalendar components:fromDate:options: takes logical combination of these calendar units to specify which components should be extracted from the given NSDate object.

[List of NSCalendar Calendar Units
 
// Following list is quoted from Apple Developer Site.
//
enum {
   NSEraCalendarUnit = kCFCalendarUnitEra,
   NSYearCalendarUnit = kCFCalendarUnitYear,
   NSMonthCalendarUnit = kCFCalendarUnitMonth,
   NSDayCalendarUnit = kCFCalendarUnitDay,
   NSHourCalendarUnit = kCFCalendarUnitHour,
   NSMinuteCalendarUnit = kCFCalendarUnitMinute,
   NSSecondCalendarUnit = kCFCalendarUnitSecond,
   NSWeekCalendarUnit = kCFCalendarUnitWeek,
   NSWeekdayCalendarUnit = kCFCalendarUnitWeekday,
   NSWeekdayOrdinalCalendarUnit = kCFCalendarUnitWeekdayOrdinal
   NSQuarterCalendarUnit = kCFCalendarUnitQuarter,
};
typedef NSUInteger NSCalendarUnit;