CFDate

Overview

CFDate objects store dates and times that can be compared to other dates and times. CFDate objects are immutable—there is no mutable counterpart for this opaque type.

CFDate provides functions for creating dates, comparing dates, and computing intervals. You use the CFDate​Create(_:​_:​) function to create CFDate objects. You use the CFDate​Compare(_:​_:​_:​) function to compare two dates, and the CFDate​Get​Time​Interval​Since​Date(_:​_:​) function to compute a time interval. Additional functions for managing dates and times are described in Time Utilities

CFDate is “toll-free bridged” with its Cocoa Foundation counterpart, NSDate. What this means is that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. In other words, in a method where you see an NSDate * parameter, you can pass in a CFDate​Ref, and in a function where you see a CFDate​Ref parameter, you can pass in an NSDate instance. This also applies to concrete subclasses of NSDate. See Interchangeable Data Types for more information on toll-free bridging.

Symbols

CFDate Miscellaneous Functions

func CFDate​Compare(CFDate!, CFDate!, Unsafe​Mutable​Raw​Pointer!)

Compares two CFDate objects and returns a comparison result.

func CFDate​Create(CFAllocator!, CFAbsolute​Time)

Creates a CFDate object given an absolute time.

func CFDate​Get​Absolute​Time(CFDate!)

Returns a CFDate object’s absolute time.

func CFDate​Get​Time​Interval​Since​Date(CFDate!, CFDate!)

Returns the number of elapsed seconds between the given CFDate objects.

func CFDate​Get​Type​ID()

Returns the type identifier for the CFDate opaque type.

Data Types

CFDate

A reference to an immutable CFDate object.