Computes the components which are indicated by the componentDesc description string for the given absolute time.
SDKs
- iOS 2.0+
- macOS 10.4+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Core Foundation
Declaration
Boolean CFCalendarDecomposeAbsoluteTime(CFCalendar Ref calendar, CFAbsolute Time 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 vararg parameters.
...
Vararg 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 component
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);