Returns a date object representing a given string.


func CFDateFormatterCreateDateFromString(_ allocator: CFAllocator!, _ formatter: CFDateFormatter!, _ string: CFString!, _ rangep: UnsafeMutablePointer<CFRange>!) -> CFDate!



The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.


The date formatter object to use to parse string.


The string that contains the date.


A reference to the range within the string specifying the substring to be parsed. If NULL, the whole string is parsed. Upon return, contains the range that defines the extent of the parse (may be less than the given range).

Return Value

A new date that represents string, or NULL if there was a problem creating the object. Ownership follows the The Create Rule.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software