Instance Method

setValue:forComponent:

Sets a value for a given calendar unit.

Declaration

- (void)setValue:(NSInteger)value forComponent:(NSCalendarUnit)unit;

Parameters

value

The value to set for the unit component.

unit

The calendar unit for which to set 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 set for an NSCalendarUnit value.

See Also

Accessing Components as Calendrical Units

- valueForComponent:

Returns the value for a given calendar unit.

NSCalendarUnit

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