<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFDateFormatter",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@T@CFDateFormatterRef"
  },
  "title" : "CFDateFormatter"
}
-->

# CFDateFormatter

```
class CFDateFormatter
```

## Overview

CFDateFormatter objects format the textual representations of CFDate and CFAbsoluteTime objects, and convert textual representations of dates and times into CFDate and CFAbsoluteTime objects. You can express the representation of dates and times very flexibly, for example “Thu 22 Dec 1994” is just as acceptable as “12/22/94.” You specify how strings are formatted and parsed by setting a format string and other properties of a CFDateFomatter object.

The format of the format string itself is defined by Unicode Technical Standard #35; the version of the standard used varies with release of the operating system, and is described in [Introduction to Data Formatting Programming Guide For Cocoa](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DataFormatting/DataFormatting.html#//apple_ref/doc/uid/10000029).

> Note:
> CFDateFormatter is not thread safe, so you must not mutate a given date formatter simultaneously from multiple threads.

## Topics

### Creating a Date Formatter

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

Creates a new CFDateFormatter object, localized to the given locale, which will format dates to the given date and time styles.

### Configuring a Date Formatter

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

Sets the format string of the given date formatter to the specified value.

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

Sets a date formatter property using a key-value pair.

### Parsing Strings

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

Returns a date object representing a given string.

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

Returns an absolute time object representing a given string.

### Creating Strings From Data

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

Returns a string representation of the given absolute time using the specified date formatter.

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

Returns a string representation of the given date using the specified date formatter.

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

Returns a localized date format string representing the given date format components arranged appropriately for the specified locale.

### Getting Information About a Date Formatter

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

Returns a copy of a date formatter’s value for a given key.

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

Returns the date style used to create the given date formatter object.

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

Returns a format string for the given date formatter object.

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

Returns the locale object used to create the given date formatter object.

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

Returns the time style used to create the given date formatter object.

### Getting the CFDateFormatter Type ID

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

Returns the type identifier for CFDateFormatter.

### Data Types

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

Data type for predefined date and time format styles.

### Constants

[Date Formatter Styles](/documentation/CoreFoundation/date_formatter_styles)

Predefined date and time format styles.

[Date Formatter Property Keys](/documentation/CoreFoundation/date-formatter-property-keys)

Keys used in key-value pairs to discover and specify the value of date formatter properties—used in conjunction with [`CFDateFormatterCopyProperty(_:_:)`](/documentation/CoreFoundation/CFDateFormatterCopyProperty(_:_:)) and [`CFDateFormatterSetProperty(_:_:_:)`](/documentation/CoreFoundation/CFDateFormatterSetProperty(_:_:_:)).

[Calendar Names](/documentation/CoreFoundation/calendar-names)

Calendar names used by CFDateFormatter.

## See Also

  [Data Formatting Guide for Core Foundation](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFDataFormatting/Articles/CFDataFormatting.html#//apple_ref/doc/uid/10000176i)



---

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)