Up

NSCalendar documentation

Authors

Generated by Gregory John Casamento,,,

Date: Generated at 2023-12-20 19:35:39 -0500


Contents -

  1. Software documentation for the NSCalendar class
  2. Software documentation for the NSDateComponents class

Software documentation for the NSCalendar class

NSCalendar : NSObject

Declared in:
Foundation/NSCalendar.h
Conforms to:
NSCoding
NSCopying
Availability: MacOS-X 10.4.0

Description forthcoming.
Method summary

autoupdatingCurrentCalendar 

+ (id) autoupdatingCurrentCalendar;
Availability: MacOS-X 10.5.0

A calendar that tracks changes to the user's calendar.

calendarWithIdentifier: 

+ (id) calendarWithIdentifier: (NSString*)string;
Availability: MacOS-X 10.4.0

Create a calendar with the given string as identifier.

currentCalendar 

+ (id) currentCalendar;
Availability: MacOS-X 10.4.0

Returns the current calendar.

calendarIdentifier 

- (NSString*) calendarIdentifier;
Availability: MacOS-X 10.4.0

Returns the calendar identifier for the receiver.

component: fromDate: 

- (NSInteger) component: (NSCalendarUnit)unit fromDate: (NSDate*)date;
Availability: MacOS-X 10.9.0

Returns the integer value of the specified unit from the given date.

components: fromDate: 

- (NSDateComponents*) components: (NSUInteger)unitFlags fromDate: (NSDate*)date;
Availability: MacOS-X 10.4.0

Returns the calendar units specified by unitFlags for the given date object.

components: fromDate: toDate: options: 

- (NSDateComponents*) components: (NSUInteger)unitFlags fromDate: (NSDate*)startingDate toDate: (NSDate*)resultDate options: (NSUInteger)opts;
Availability: MacOS-X 10.4.0

Compute the different between the specified components in the two dates. Values are summed up as long as now higher-granularity unit is specified. That means if you want to extract the year and the day from two dates which are 13 months + 1 day apart, you will get 1 as the result for the year but the rest of the difference in days. (29 <= x <= 32, depending on the month). Please note that the NSWrapCalendarComponents option that should affect the calculations is not presently supported.

dateByAddingComponents: toDate: options: 

- (NSDate*) dateByAddingComponents: (NSDateComponents*)comps toDate: (NSDate*)date options: (NSUInteger)opts;
Availability: MacOS-X 10.4.0

Returns a date object created by adding the NSDateComponents in comps to to object date with the options specified by opts.

dateFromComponents: 

- (NSDate*) dateFromComponents: (NSDateComponents*)comps;
Availability: MacOS-X 10.4.0

Creates an NSDate from NSDateComponents in comps.

firstWeekday 

- (NSUInteger) firstWeekday;
Availability: MacOS-X 10.4.0

Returns the integer value of the first weekday (0-6).

getEra: year: month: day: fromDate: 

- (void) getEra: (NSInteger*)eraValuePointer year: (NSInteger*)yearValuePointer month: (NSInteger*)monthValuePointer day: (NSInteger*)dayValuePointer fromDate: (NSDate*)date;
Availability: MacOS-X 10.9.0

Returns by reference the era, year, month, and day from the given date.

getEra: yearForWeekOfYear: weekOfYear: weekday: fromDate: 

- (void) getEra: (NSInteger*)eraValuePointer yearForWeekOfYear: (NSInteger*)yearValuePointer weekOfYear: (NSInteger*)weekValuePointer weekday: (NSInteger*)weekdayValuePointer fromDate: (NSDate*)date;
Availability: MacOS-X 10.9.0

Returns by reference the era, year, week of year, and weekday from the given date.

getHour: minute: second: nanosecond: fromDate: 

- (void) getHour: (NSInteger*)hourValuePointer minute: (NSInteger*)minuteValuePointer second: (NSInteger*)secondValuePointer nanosecond: (NSInteger*)nanosecondValuePointer fromDate: (NSDate*)date;
Availability: MacOS-X 10.9.0

Returns by reference the hour, minute, second, and nanosecond from the given date.

initWithCalendarIdentifier: 

- (id) initWithCalendarIdentifier: (NSString*)string;
Availability: MacOS-X 10.4.0

Instantiate a calendar with the given string as identifier.

locale 

- (NSLocale*) locale;
Availability: MacOS-X 10.4.0

Returns the locale of the receiver.

maximumRangeOfUnit: 

- (NSRange) maximumRangeOfUnit: (NSCalendarUnit)unit;
Availability: MacOS-X 10.4.0

Returns the maximum range of unit.

minimumDaysInFirstWeek 

- (NSUInteger) minimumDaysInFirstWeek;
Availability: MacOS-X 10.4.0

Returns the minimum number of days in the first week of the receiver.

minimumRangeofUnit: 

- (NSRange) minimumRangeofUnit: (NSCalendarUnit)unit;
Availability: MacOS-X 10.4.0

Returns the minimum range of unit.

ordinalityOfUnit: inUnit: forDate: 

- (NSUInteger) ordinalityOfUnit: (NSCalendarUnit)smaller inUnit: (NSCalendarUnit)larger forDate: (NSDate*)date;
Availability: MacOS-X 10.4.0

Returns the ordinality of unit smaller within the unit larger with the given date.

rangeOfUnit: inUnit: forDate: 

- (NSRange) rangeOfUnit: (NSCalendarUnit)smaller inUnit: (NSCalendarUnit)larger forDate: (NSDate*)date;
Availability: MacOS-X 10.4.0

Returns the range of unit smaller in larger in date.

rangeOfUnit: startDate: interval: forDate: 

- (BOOL) rangeOfUnit: (NSCalendarUnit)unit startDate: (NSDate**)datep interval: (NSTimeInterval*)tip forDate: (NSDate*)date;
Availability: MacOS-X 10.5.0

Returns by referene the started time and duration of a given unit containing the given date.

setFirstWeekday: 

- (void) setFirstWeekday: (NSUInteger)weekday;
Availability: MacOS-X 10.4.0

Set the integer first weekday of the week (0-6).

setLocale: 

- (void) setLocale: (NSLocale*)locale;
Availability: MacOS-X 10.4.0

Sets the locale of the receiver.

setMinimumDaysInFirstWeek: 

- (void) setMinimumDaysInFirstWeek: (NSUInteger)mdw;
Availability: MacOS-X 10.4.0

Sets the minimum number of days in the first week of the receiver.

setTimeZone: 

- (void) setTimeZone: (NSTimeZone*)tz;
Availability: MacOS-X 10.4.0

Sets tz as the current NSTimeZone of the receiver.

timeZone 

- (NSTimeZone*) timeZone;
Availability: MacOS-X 10.4.0

Returns the NSTimeZone associated with the receiver.

Software documentation for the NSDateComponents class

NSDateComponents : NSObject

Declared in:
Foundation/NSCalendar.h
Conforms to:
NSCopying
Availability: MacOS-X 10.4.0

Description forthcoming.
Method summary

calendar 

- (NSCalendar*) calendar;
Availability: MacOS-X 10.7.0

Description forthcoming.

date 

- (NSDate*) date;
Availability: MacOS-X 10.7.0

Computes a date by using the components set in this NSDateComponents instance.

A calendar (and optionally a time zone) must be set prior to calling this method.


day 

- (NSInteger) day;
Availability: MacOS-X 10.4.0

Description forthcoming.

era 

- (NSInteger) era;
Availability: MacOS-X 10.4.0

Description forthcoming.

hour 

- (NSInteger) hour;
Availability: MacOS-X 10.4.0

Description forthcoming.

isValidDate 

- (BOOL) isValidDate;
Availability: MacOS-X 10.9.0

Description forthcoming.

isValidDateInCalendar: 

- (BOOL) isValidDateInCalendar: (NSCalendar*)calendar;
Availability: MacOS-X 10.9.0

Description forthcoming.

leapMonth 

- (BOOL) leapMonth;
Availability: MacOS-X 10.8.0

Description forthcoming.

minute 

- (NSInteger) minute;
Availability: MacOS-X 10.4.0

Description forthcoming.

month 

- (NSInteger) month;
Availability: MacOS-X 10.4.0

Description forthcoming.

nanosecond 

- (NSInteger) nanosecond;
Availability: MacOS-X 10.7.0

Description forthcoming.

quarter 

- (NSInteger) quarter;
Availability: MacOS-X 10.6.0

Description forthcoming.

second 

- (NSInteger) second;
Availability: MacOS-X 10.4.0

Description forthcoming.

setCalendar: 

- (void) setCalendar: (NSCalendar*)cal;
Availability: MacOS-X 10.7.0

Description forthcoming.

setDay: 

- (void) setDay: (NSInteger)v;
Availability: MacOS-X 10.4.0

Description forthcoming.

setEra: 

- (void) setEra: (NSInteger)v;
Availability: MacOS-X 10.4.0

Description forthcoming.

setHour: 

- (void) setHour: (NSInteger)v;
Availability: MacOS-X 10.4.0

Description forthcoming.

setLeapMonth: 

- (void) setLeapMonth: (BOOL)v;
Availability: MacOS-X 10.8.0

Description forthcoming.

setMinute: 

- (void) setMinute: (NSInteger)v;
Availability: MacOS-X 10.4.0

Description forthcoming.

setMonth: 

- (void) setMonth: (NSInteger)v;
Availability: MacOS-X 10.4.0

Description forthcoming.

setNanosecond: 

- (void) setNanosecond: (NSInteger)v;
Availability: MacOS-X 10.7.0

Description forthcoming.

setQuarter: 

- (void) setQuarter: (NSInteger)v;
Availability: MacOS-X 10.6.0

Description forthcoming.

setSecond: 

- (void) setSecond: (NSInteger)v;
Availability: MacOS-X 10.4.0

Description forthcoming.

setTimeZone: 

- (void) setTimeZone: (NSTimeZone*)tz;
Availability: MacOS-X 10.7.0

Description forthcoming.

setValue: forComponent: 

- (void) setValue: (NSInteger)value forComponent: (NSCalendarUnit)unit;
Availability: MacOS-X 10.9.0

Description forthcoming.

setWeek: 

- (void) setWeek: (NSInteger)v;
Availability: MacOS-X 10.4.0

Description forthcoming.

setWeekOfMonth: 

- (void) setWeekOfMonth: (NSInteger)v;
Availability: MacOS-X 10.7.0

Sets the number of the week in this month.

setWeekOfYear: 

- (void) setWeekOfYear: (NSInteger)v;
Availability: MacOS-X 10.7.0

Sets the number of the week in this year. Identical to calling -setWeek: .

setWeekday: 

- (void) setWeekday: (NSInteger)v;
Availability: MacOS-X 10.4.0

Description forthcoming.

setWeekdayOrdinal: 

- (void) setWeekdayOrdinal: (NSInteger)v;
Availability: MacOS-X 10.4.0

Description forthcoming.

setYear: 

- (void) setYear: (NSInteger)v;
Availability: MacOS-X 10.4.0

Description forthcoming.

setYearForWeekOfYear: 

- (void) setYearForWeekOfYear: (NSInteger)v;
Availability: MacOS-X 10.7.0

Sets the year number for the current week. See the explanation at -yearForWeekOfYear .

timeZone 

- (NSTimeZone*) timeZone;
Availability: MacOS-X 10.7.0

Description forthcoming.

valueForComponent: 

- (NSInteger) valueForComponent: (NSCalendarUnit)unit;
Availability: MacOS-X 10.9.0

Description forthcoming.

week 

- (NSInteger) week;
Availability: MacOS-X 10.4.0

Description forthcoming.

weekOfMonth 

- (NSInteger) weekOfMonth;
Availability: MacOS-X 10.7.0

Returns the number of the week in this month.

weekOfYear 

- (NSInteger) weekOfYear;
Availability: MacOS-X 10.7.0

Returns the number of the week in this year. Identical to calling week.

weekday 

- (NSInteger) weekday;
Availability: MacOS-X 10.4.0

Description forthcoming.

weekdayOrdinal 

- (NSInteger) weekdayOrdinal;
Availability: MacOS-X 10.4.0

Description forthcoming.

year 

- (NSInteger) year;
Availability: MacOS-X 10.4.0

Description forthcoming.

yearForWeekOfYear 

- (NSInteger) yearForWeekOfYear;
Availability: MacOS-X 10.7.0

The year corresponding to the current week. This value may differ from year around the end of the year. For example, for 2012-12-31, the year number is 2012, but yearForWeekOfYear is 2013, since it's already week 1 in 2013.


Up