One Logo Pool Ball
Foundation · IOS API REFERENCE

Date.FormatStyle.Symbol.Weekday

struct · iOS 15.0+ · SDK 27.1

struct Weekday

A type that specifies the format for the weekday name in a date format style. The type ``Date/FormatStyle/Symbol/Weekday`` includes static factory variables that create custom ``Date/FormatStyle/Symbol/Weekday`` objects: |Factory variable|Description| |---|---| | ``Date/FormatStyle/Symbol/Weekday/abbreviated`` | Abbreviated weekday name. For example, `Tue`. | | ``Date/FormatStyle/Symbol/Weekday/wide`` | Wide weekday name. For example, `Tuesday`. | | ``Date/FormatStyle/Symbol/Weekday/narrow`` | Narrow weekday name. For example, `T`. | | ``short`` | Short weekday name. For example, `Tu`. | | ``oneDigit`` | Local numeric one-digit day of week. The value depends on the local starting day of the week. For example, this is `2` if Sunday is the first day of the week. | | ``twoDigits`` | Local numeric two-digit day of week, zero-padded if necessary. The value depends on the local starting day of the week. For example, this is `02` if Sunday is the first day of the week. | To customize the weekday, name format in a string representation of a `Date`, use ``Date/FormatStyle/weekday(_:)``. This example shows a variety of ``Date/FormatStyle/Symbol/Weekday`` format styles applied to a Thursday, using locale `en_US`: ```swift let meetingDate = Date() // Feb 18, 2021 at 3:00 PM meetingDate.formatted(Date.FormatStyle().weekday(.abbreviated)) // Thu meetingDate.formatted(Date.FormatStyle().weekday(.narrow)) // T meetingDate.formatted(Date.FormatStyle().weekday(.short)) // Th meetingDate.formatted(Date.FormatStyle().weekday(.wide)) // Thursday meetingDate.formatted(Date.FormatStyle().weekday(.oneDigit)) // 5 meetingDate.formatted(Date.FormatStyle().weekday(.twoDigits)) // 05 meetingDate.formatted(Date.FormatStyle().weekday()) // Thu ``` If no format is specified as a parameter, the ``Date/FormatStyle/Symbol/Weekday/abbreviated`` static variable is the default format. For more information about formatting dates, see the ``Date/FormatStyle``.

Members (7)

get · iOS 15.0+

abbreviated

TypeScript
static get abbreviated(): Date_FormatStyle_Symbol_Weekday
Swift declaration
static var abbreviated: Date.FormatStyle.Symbol.Weekday { get }

Abbreviated day of week name. For example, "Tue".

get · iOS 15.0+

wide

TypeScript
static get wide(): Date_FormatStyle_Symbol_Weekday
Swift declaration
static var wide: Date.FormatStyle.Symbol.Weekday { get }

Wide day of week name. For example, "Tuesday".

get · iOS 15.0+

short

TypeScript
static get short(): Date_FormatStyle_Symbol_Weekday
Swift declaration
static var short: Date.FormatStyle.Symbol.Weekday { get }

Short day of week name. For example, "Tu".

get · iOS 15.0+

narrow

TypeScript
static get narrow(): Date_FormatStyle_Symbol_Weekday
Swift declaration
static var narrow: Date.FormatStyle.Symbol.Weekday { get }

Narrow day of week name. For example, "T".

get · iOS 18.0+

omitted

TypeScript
static get omitted(): Date_FormatStyle_Symbol_Weekday
Swift declaration
static let omitted: Date.FormatStyle.Symbol.Weekday

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

get · iOS 15.0+

oneDigit

TypeScript
static get oneDigit(): Date_FormatStyle_Symbol_Weekday
Swift declaration
static var oneDigit: Date.FormatStyle.Symbol.Weekday { get }

Local day of week number/name. The value depends on the local starting day of the week.

get · iOS 15.0+

twoDigits

TypeScript
static get twoDigits(): Date_FormatStyle_Symbol_Weekday
Swift declaration
static var twoDigits: Date.FormatStyle.Symbol.Weekday { get }

Local day of week number/name, format style; two digits, zero-padded if necessary.

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →