<!--
{
  "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/Symbol/Week",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4DateV11FormatStyleV6SymbolV4WeekV"
  },
  "title" : "Date.FormatStyle.Symbol.Week"
}
-->

# Date.FormatStyle.Symbol.Week

A type that specifies the format for the week in a date format style.

```
struct Week
```

## Overview

The type [`Date.FormatStyle.Symbol.Week`](/documentation/Foundation/Date/FormatStyle/Symbol/Week) includes static factory variables that create custom [`Date.FormatStyle.Symbol.Week`](/documentation/Foundation/Date/FormatStyle/Symbol/Week) objects:

|Factory variable                                                                                  |Description                                                                                |
|--------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
|``doc://com.apple.foundation/documentation/Foundation/Date/FormatStyle/Symbol/Week/defaultDigits``|The minimum number of digits that represents the full numeric week. For example, `1`, `18`.|
|``doc://com.apple.foundation/documentation/Foundation/Date/FormatStyle/Symbol/Week/twoDigits``    |Two-digit numeric week, zero-padded if necessary. For example, `01`, `18`.                 |
|``doc://com.apple.foundation/documentation/Foundation/Date/FormatStyle/Symbol/Week/weekOfMonth``  |The numeric week of the month. For example, `1`, `4`.                                      |

To customize the week format in a string representation of a `Date`, use [`week(_:)`](/documentation/Foundation/Date/FormatStyle/week(_:)). The following 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 week of the month `1`. If no format is specified as a parameter, the [`defaultDigits`](/documentation/Foundation/Date/FormatStyle/Symbol/Week/defaultDigits) static variable is the default format.

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

## Topics

### Modifying a Week

[`static var defaultDigits: Date.FormatStyle.Symbol.Week`](/documentation/Foundation/Date/FormatStyle/Symbol/Week/defaultDigits)

Custom week format style showing the minimum number of digits that represents the numeric week.

[`static var twoDigits: Date.FormatStyle.Symbol.Week`](/documentation/Foundation/Date/FormatStyle/Symbol/Week/twoDigits)

Custom format style portraying the two-digit numeric week, zero-padded if necessary.

[`static var weekOfMonth: Date.FormatStyle.Symbol.Week`](/documentation/Foundation/Date/FormatStyle/Symbol/Week/weekOfMonth)

Custom format style portraying the numeric week of the month.

### Comparing Weeks

[`static func == (Date, Date) -> Bool`](/documentation/Foundation/Date/==(_:_:))

Returns true if the two `Date` values represent the same point in time.

### Type Properties

[`static let omitted: Date.FormatStyle.Symbol.Week`](/documentation/Foundation/Date/FormatStyle/Symbol/Week/omitted)

The option for not including the symbol in the formatted output.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Hashable`](/documentation/Swift/Hashable)

[`Sendable`](/documentation/Swift/Sendable)

---

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)