<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/DateFormatter/dateFormat",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDateFormatter(py)dateFormat"
  },
  "title" : "dateFormat"
}
-->

# dateFormat

The date format string used by the receiver.

```
var dateFormat: String! { get set }
```

## Discussion

See [Data Formatting Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DataFormatting/DataFormatting.html#//apple_ref/doc/uid/10000029i) for a list of the conversion specifiers permitted in date format strings.

You should only set this property when working with fixed format representations, as discussed in [`Working With Fixed Format Date Representations`](/documentation/Foundation/DateFormatter#Working-With-Fixed-Format-Date-Representations). For user-visible representations, you should use the [`dateStyle`](/documentation/Foundation/DateFormatter/dateStyle) and [`timeStyle`](/documentation/Foundation/DateFormatter/timeStyle) properties, or the [`setLocalizedDateFormatFromTemplate(_:)`](/documentation/Foundation/DateFormatter/setLocalizedDateFormatFromTemplate(_:)) method if your desired format cannot be achieved using the predefined styles; both of these properties and this method provide a localized date representation appropriate for display to the user.

---

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)