CFCalendarDecomposeAbsoluteTime
Computes the components which are indicated by the componentDesc description string for the given absolute time.
Declaration
extern Boolean CFCalendarDecomposeAbsoluteTime(CFCalendarRef calendar, CFAbsoluteTime at, const char *componentDesc, ...);Parameters
- calendar:
The calendar to use for the computation.
- at:
An absolute time.
- componentDesc:
A string that describes the components provided in the variadic parameters if pointers to storage for each of the desired components. On successful return, the pointers are filled with values of the corresponding components. The type of all units is
int.
Return Value
TRUE if the function is able to compute the components indicated by the componentDesc description string for the given absolute time, and fills the values to the components given in the varargs. Returns FALSE if the absolute time falls outside the defined range of the calendar, or the computation cannot be performed.
Discussion
The Weekday ordinality, when requested, refers to the next larger (than Week) of the requested units. Some computations can take a relatively long time to perform.
The following example shows how to use this function to determine the current year, month, and day, using an existing calendar (gregorian):
CFCalendarDecomposeAbsoluteTime(gregorian, CFAbsoluteTimeGetCurrent(), "yMd", &year, &month, &day);