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

# format(_:)

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

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

## Parameters

`value`

The date to format.

## Return Value

An attributed string representation of the date.

## Discussion

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

For an example of formatting multiple dates into plain strings, see [`format(_:)`](/documentation/Foundation/Date/FormatStyle/format(_:)).

---

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)