# NSCalendar documentation

Generated at 2025-12-02 21:52:00 +0000
2010 Free Software Foundation, Inc.
Software documentation for the NSCalendar class
Foundation/NSCalendar.h
NSCoding
NSCopying
Description forthcoming.
autoupdatingCurrentCalendar
A calendar that tracks changes to the user's calendar.
calendarWithIdentifier:
string
Create a calendar with the given string as identifier.
currentCalendar
Returns the current calendar.
calendarIdentifier
Returns the calendar identifier for the receiver.
component:
unit
fromDate:
date
Returns the integer value of the specified unit from the given date.
components:
unitFlags
fromDate:
date
Returns the calendar units specified by unitFlags for the given date object.
components:
unitFlags
fromDate:
startingDate
toDate:
resultDate
options:
opts
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:
comps
toDate:
date
options:
opts
Returns a date object created by adding the NSDateComponents in comps to to object date with the options specified by opts.
dateFromComponents:
comps
Creates an NSDate from NSDateComponents in comps.
firstWeekday
Returns the integer value of the first weekday (0-6).
getEra:
eraValuePointer
year:
yearValuePointer
month:
monthValuePointer
day:
dayValuePointer
fromDate:
date
Returns by reference the era, year, month, and day from the given date.
getEra:
eraValuePointer
yearForWeekOfYear:
yearValuePointer
weekOfYear:
weekValuePointer
weekday:
weekdayValuePointer
fromDate:
date
Returns by reference the era, year, week of year, and weekday from the given date.
getHour:
hourValuePointer
minute:
minuteValuePointer
second:
secondValuePointer
nanosecond:
nanosecondValuePointer
fromDate:
date
Returns by reference the hour, minute, second, and nanosecond from the given date.
initWithCalendarIdentifier:
string
Instantiate a calendar with the given string as identifier.
locale
Returns the locale of the receiver.
maximumRangeOfUnit:
unit
Returns the maximum range of unit.
minimumDaysInFirstWeek
Returns the minimum number of days in the first week of the receiver.
minimumRangeofUnit:
unit
Returns the minimum range of unit.
ordinalityOfUnit:
smaller
inUnit:
larger
forDate:
date
Returns the ordinality of unit smaller within the unit larger with the given date.
rangeOfUnit:
smaller
inUnit:
larger
forDate:
date
Returns the range of unit smaller in larger in date.
rangeOfUnit:
unit
startDate:
datep
interval:
tip
forDate:
date
Returns by referene the started time and duration of a given unit containing the given date.
setFirstWeekday:
weekday
Set the integer first weekday of the week (0-6).
setLocale:
locale
Sets the locale of the receiver.
setMinimumDaysInFirstWeek:
mdw
Sets the minimum number of days in the first week of the receiver.
setTimeZone:
tz
Sets tz as the current NSTimeZone of the receiver.
timeZone
Returns the NSTimeZone associated with the receiver.
Software documentation for the NSDateComponents class
Foundation/NSCalendar.h
NSCopying
Description forthcoming.
calendar
Description forthcoming.
date

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
Description forthcoming.
era
Description forthcoming.
hour
Description forthcoming.
isValidDate
Description forthcoming.
isValidDateInCalendar:
calendar
Description forthcoming.
leapMonth
Description forthcoming.
minute
Description forthcoming.
month
Description forthcoming.
nanosecond
Description forthcoming.
quarter
Description forthcoming.
second
Description forthcoming.
setCalendar:
cal
Description forthcoming.
setDay:
v
Description forthcoming.
setEra:
v
Description forthcoming.
setHour:
v
Description forthcoming.
setLeapMonth:
v
Description forthcoming.
setMinute:
v
Description forthcoming.
setMonth:
v
Description forthcoming.
setNanosecond:
v
Description forthcoming.
setQuarter:
v
Description forthcoming.
setSecond:
v
Description forthcoming.
setTimeZone:
tz
Description forthcoming.
setValue:
value
forComponent:
unit
Description forthcoming.
setWeek:
v
Description forthcoming.
setWeekOfMonth:
v
Sets the number of the week in this month.
setWeekOfYear:
v
Sets the number of the week in this year. Identical to calling `-setWeek:` .
setWeekday:
v
Description forthcoming.
setWeekdayOrdinal:
v
Description forthcoming.
setYear:
v
Description forthcoming.
setYearForWeekOfYear:
v
Sets the year number for the current week. See the explanation at `-yearForWeekOfYear` .
timeZone
Description forthcoming.
valueForComponent:
unit
Description forthcoming.
week
Description forthcoming.
weekOfMonth
Returns the number of the week in this month.
weekOfYear
Returns the number of the week in this year. Identical to calling `week`.
weekday
Description forthcoming.
weekdayOrdinal
Description forthcoming.
year
Description forthcoming.
yearForWeekOfYear
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.