---
title: "weekday(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/date/intervalformatstyle/weekday(_:)"
---

# weekday(_:)

Modifies the date interval format style to include the specified weekday style.

## Declaration

```swift
func weekday(_ format: Date.IntervalFormatStyle.Symbol.Weekday = .abbreviated) -> Date.IntervalFormatStyle
```

## Parameters

- `format`: The weekday format style to apply to the date interval format style.

## Return Value

Return Value A date interval format style that includes the specified weekday style.

## Discussion

Discussion Use a combination of modifier instance methods to customize the format of the date interval. The following example shows a combination date interval format styles that include the weekday: if let today = Calendar.current.date(byAdding: .day, value: -140, to: Date()),    let sevenDaysBeforeToday = Calendar.current.date(byAdding: .day, value: -7, to: today) {

// Create a Range<Date>.     let weekBefore = sevenDaysBeforeToday..<today

print(weekBefore.formatted(.interval.day().month(.wide).year().weekday(.wide)))     print(weekBefore.formatted(.interval.day().weekday(.abbreviated)))     print(weekBefore.formatted(.interval.day().month(.wide).weekday(.narrow))) } // Friday, February 5 – Friday, February 12, 2021 // 5 Fri – 12 Fri // F, February 5 – F, February 12

## See Also

### Modifying Date Interval Format Styles

- [day()](foundation/date/intervalformatstyle/day().md)
- [hour(_:)](foundation/date/intervalformatstyle/hour(_:).md)
- [minute()](foundation/date/intervalformatstyle/minute().md)
- [month(_:)](foundation/date/intervalformatstyle/month(_:).md)
- [second()](foundation/date/intervalformatstyle/second().md)
- [year()](foundation/date/intervalformatstyle/year().md)
