Instance Method

valueForComponent:

Returns the value for a given calendar unit.

Declaration

- (NSInteger)valueForComponent:(NSCalendarUnit)unit;

Parameters

unit

The calendar unit for which to retrieve its value. Do not pass NSCalendarUnitCalendar or NSCalendarUnitTimeZone.

Return Value

The value for the given calendar unit.

Discussion

This method allows for component values to be retrieved for an NSCalendarUnit value.

See Also

Accessing Components as Calendrical Units

- setValue:forComponent:

Sets a value for a given calendar unit.

NSCalendarUnit

Calendrical units such as year, month, day and hour.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software