<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Date/FormatStyle/format(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4DateV11FormatStyleV6formatySSACF"
  },
  "title" : "format(_:)"
}
-->

# format(_:)

Creates a locale-aware string representation from a date value.

```
func format(_ value: Date) -> String
```

## Parameters

`value`

The date to format.

## Return Value

A string representation of the date.

## Discussion

The [`format(_:)`](/documentation/Foundation/Date/FormatStyle/format(_:)) instance method generates a string from the provided date. Once you create a style, you can use it to format dates multiple times.

The following example creates a format style to guide parsing a set of string representations of dates. It also creates a second format style, applying it repeatedly to produce more detailed string representations of those dates for a different locale.

```swift
let inputFormat = Date.FormatStyle()
    .locale(Locale(identifier: "en_GB"))
    .year()
    .month()
    .day()

// Parse dates from strings using the input format defined above.
let iphoneIntroductionDate = try! Date("9 Jan 2007", strategy: inputFormat)
let ipadIntroductionDate = try! Date("27 Jan 2010", strategy: inputFormat)
let wwdc2021Date = try! Date("7 Jun 2021", strategy: inputFormat)

// Define a format style with the desired date fields.
let outputFormat = Date.FormatStyle()
    .locale(Locale(identifier: "en_US"))
    .year()
    .month(.wide)
    .day(.twoDigits)
    .weekday(.abbreviated)

// Apply the output format on the three dates below.
print(outputFormat.format(wwdc2021Date))
// Mon, June 07, 2021

print(outputFormat.format(ipadIntroductionDate))
// Wed, January 27, 2010

print(outputFormat.format(iphoneIntroductionDate))
// Tue, January 09, 2007
```

---

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)