<!--
{
  "documentType" : "article",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/time-utilities",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Time Utilities"
}
-->

# Time Utilities

## Overview

Core Foundation measures time in units of seconds. The base data type is the [`CFTimeInterval`](/documentation/CoreFoundation/CFTimeInterval), which measures the difference in seconds between two times. Fixed times, or dates, are defined by the [`CFAbsoluteTime`](/documentation/CoreFoundation/CFAbsoluteTime) data type, which measures the time interval between a particular date and the absolute reference date of Jan 1 2001 00:00:00 GMT.

The [`CFGregorianDate`](/documentation/CoreFoundation/CFGregorianDate) structure represents absolute times in terms of the Gregorian calendar. Functions such as [`CFAbsoluteTimeGetGregorianDate(_:_:)`](/documentation/CoreFoundation/CFAbsoluteTimeGetGregorianDate(_:_:)) use a [`CFTimeZone`](/documentation/CoreFoundation/CFTimeZone) object to obtain the local time in a particular time zone.

The [`CFDate`](/documentation/CoreFoundation/CFDate) opaque type wraps an absolute time into a [`CFTypeRef`](/documentation/CoreFoundation/CFTypeRef)-base object, allowing you to put time objects into collections and property lists and to be handled by other object-oriented parts of Core Foundation.

## Topics

### Core Foundation Time Utilities Miscellaneous Functions

[`CFAbsoluteTimeAddGregorianUnits(_:_:_:)`](/documentation/CoreFoundation/CFAbsoluteTimeAddGregorianUnits(_:_:_:))

Adds a time interval, expressed as Gregorian units, to a given absolute time.

[`CFAbsoluteTimeGetCurrent()`](/documentation/CoreFoundation/CFAbsoluteTimeGetCurrent())

Returns the current system absolute time.

[`CFAbsoluteTimeGetDayOfWeek(_:_:)`](/documentation/CoreFoundation/CFAbsoluteTimeGetDayOfWeek(_:_:))

Returns an integer representing the day of the week indicated by the specified absolute time.

[`CFAbsoluteTimeGetDayOfYear(_:_:)`](/documentation/CoreFoundation/CFAbsoluteTimeGetDayOfYear(_:_:))

Returns an integer representing the day of the year indicated by the specified absolute time.

[`CFAbsoluteTimeGetDifferenceAsGregorianUnits(_:_:_:_:)`](/documentation/CoreFoundation/CFAbsoluteTimeGetDifferenceAsGregorianUnits(_:_:_:_:))

Computes the time difference between two specified absolute times and returns the result as an interval in Gregorian units.

[`CFAbsoluteTimeGetGregorianDate(_:_:)`](/documentation/CoreFoundation/CFAbsoluteTimeGetGregorianDate(_:_:))

Converts an absolute time value into a Gregorian date.

[`CFAbsoluteTimeGetWeekOfYear(_:_:)`](/documentation/CoreFoundation/CFAbsoluteTimeGetWeekOfYear(_:_:))

Returns an integer representing the week of the year indicated by the specified absolute time.

[`CFGregorianDateGetAbsoluteTime(_:_:)`](/documentation/CoreFoundation/CFGregorianDateGetAbsoluteTime(_:_:))

Converts a Gregorian date value into an absolute time value.

[`CFGregorianDateIsValid(_:_:)`](/documentation/CoreFoundation/CFGregorianDateIsValid(_:_:))

Checks the specified fields of a CFGregorianDate structure for valid values.

### Data Types

[`CFAbsoluteTime`](/documentation/CoreFoundation/CFAbsoluteTime)

Type used to represent a specific point in time relative to the absolute reference date of 1 Jan 2001 00:00:00 GMT.

[`CFGregorianDate`](/documentation/CoreFoundation/CFGregorianDate)

Structure used to represent a point in time using the Gregorian calendar.

[`CFGregorianUnits`](/documentation/CoreFoundation/CFGregorianUnits)

Structure used to represent a time interval in Gregorian units.

[`CFTimeInterval`](/documentation/CoreFoundation/CFTimeInterval)

Type used to represent elapsed time in seconds.

### Constants

[`CFGregorianUnitFlags`](/documentation/CoreFoundation/CFGregorianUnitFlags)

These option flags are used as a mask to indicate a specific set of fields in the CFGregorianDate or CFGregorianUnits structures.

[Predefined Time Interval Values](/documentation/CoreFoundation/predefined-time-interval-values)

Time intervals between the absolute reference date and certain other dates.

## See Also

  [Date and Time Programming Guide for Core Foundation](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFDatesAndTimes/CFDatesAndTimes.html#//apple_ref/doc/uid/10000125i)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)