<!--
{
  "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/FormatStyle/interval",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation11FormatStylePA2A4DateV08IntervalbC0VRszrlE8intervalAGvpZ"
  },
  "title" : "interval"
}
-->

# interval

A style for formatting a date interval.

```
static var interval: Date.IntervalFormatStyle { get }
```

## Discussion

Use this type property when the call point allows the use of [`Date.IntervalFormatStyle`](/documentation/Foundation/Date/IntervalFormatStyle). You typically do this when calling the <doc://com.apple.documentation/documentation/Swift/Range/formatted(_:)> method of a `Range<Date>`.

The folllowing example uses [`interval`](/documentation/Foundation/FormatStyle/interval) to create a date interval string with specific styling of the day, month, and weekday components, omitting the year and time.

```swift
if let today = Calendar.current.date(byAdding: .day, value: -120, to: Date()),
    let thirtyDaysBeforeToday = Calendar.current.date(byAdding: .day, value: -30, to: today) {
    // today: June 5, 2023
    // thirtyDaysBeforeToday: May 6, 2023

    // Create a Range<Date>.
    let last30days = thirtyDaysBeforeToday..<today

    let formatted = last30days.formatted(
        .interval
        .day()
        .month(.wide)
        .weekday(.abbreviated)
    ) // "Sat, May 6 – Mon, June 5"
}
```

---

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)