<!--
{
  "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/ComponentsFormatStyle/init(style:locale:calendar:fields:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4DateV21ComponentsFormatStyleV5style6locale8calendar6fieldsA2E0E0V_AA6LocaleVAA8CalendarVShyAE5FieldVGSgtcfc"
  },
  "title" : "init(style:locale:calendar:fields:)"
}
-->

# init(style:locale:calendar:fields:)

Shows the date interval with the specified style and the specified date and time fields.

```
init(style: Date.ComponentsFormatStyle.Style, locale: Locale = .autoupdatingCurrent, calendar: Calendar = .autoupdatingCurrent, fields: Set<Date.ComponentsFormatStyle.Field>? = nil)
```

## Parameters

`style`

The style for the field names.

`locale`

The locale for formatting the date interval. May affect the language in which the formatted fields are displayed and how the individual fields are connected.

`calendar`

The calendar to interpret date values.

`fields`

The fields to be included in the output string. Chosen automatically based on the interval being formatted if unspecified. Fields with 0 value are dropped.

---

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)