<!--
{
  "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/week(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4DateV11FormatStyleV4weekyA2E6SymbolV4WeekVF"
  },
  "title" : "week(_:)"
}
-->

# week(_:)

Modifies the date format style to use the specified week format style.

```
func week(_ format: Date.FormatStyle.Symbol.Week = .defaultDigits) -> Date.FormatStyle
```

## Parameters

`format`

The week format style applied to the date format style.

## Return Value

A date format style modified to include the specified week format style.

## Discussion

Possible values of [`Date.FormatStyle.Symbol.Week`](/documentation/Foundation/Date/FormatStyle/Symbol/Week) include [`defaultDigits`](/documentation/Foundation/Date/FormatStyle/Symbol/Week/defaultDigits), [`twoDigits`](/documentation/Foundation/Date/FormatStyle/Symbol/Week/twoDigits), and [`weekOfMonth`](/documentation/Foundation/Date/FormatStyle/Symbol/Week/weekOfMonth).

This example shows a variety of [`Date.FormatStyle.Symbol.Week`](/documentation/Foundation/Date/FormatStyle/Symbol/Week) format styles applied to a date:

```swift
let meetingDate = Date() // May 3, 2021 at 3:00 PM
meetingDate.formatted(Date.FormatStyle().week(.defaultDigits)) // 19
meetingDate.formatted(Date.FormatStyle().week(.twoDigits)) // 19
meetingDate.formatted(Date.FormatStyle().week(.weekOfMonth)) // 2
meetingDate.formatted(Date.FormatStyle().week()) // 19
```

An incomplete week at the start of a month is the first week of the month `1`. If you don’t provide a format, the [`defaultDigits`](/documentation/Foundation/Date/FormatStyle/Symbol/Week/defaultDigits) static variable is the default format.

For more information about formatting dates, see [`Date.FormatStyle`](/documentation/Foundation/Date/FormatStyle).

---

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)