One Logo Pool Ball
Foundation · IOS API REFERENCE

Date.FormatStyle.DateStyle

struct · iOS 15.0+ · SDK 27.1

struct DateStyle

Type that defines date styles varied in length or components included. The exact format depends on the locale. Possible values of date style include ``omitted``, ``numeric``, ``abbreviated``, ``long``, and ``complete``. The following code sample shows a variety of date style format results using the `en_US` locale. ```swift let meetingDate = Date() meetingDate.formatted(date: .omitted, time: .standard) // 9:42:14 AM meetingDate.formatted(date: .numeric, time: .omitted) // 10/17/2020 meetingDate.formatted(date: .abbreviated, time: .omitted) // Oct 17, 2020 meetingDate.formatted(date: .long, time: .omitted) // October 17, 2020 meetingDate.formatted(date: .complete, time: .omitted) // Saturday, October 17, 2020 meetingDate.formatted() // 10/17/2020, 9:42 AM ``` The default date style is `numeric`.

Members (5)

get · iOS 15.0+

abbreviated

TypeScript
static get abbreviated(): Date_FormatStyle_DateStyle
Swift declaration
static let abbreviated: Date.FormatStyle.DateStyle

Shows date components in their abbreviated form if possible. For example, "Oct 21, 2015".

get · iOS 15.0+

long

TypeScript
static get long(): Date_FormatStyle_DateStyle
Swift declaration
static let long: Date.FormatStyle.DateStyle

Shows date components in their long form if possible. For example, "October 21, 2015".

get · iOS 15.0+

numeric

TypeScript
static get numeric(): Date_FormatStyle_DateStyle
Swift declaration
static let numeric: Date.FormatStyle.DateStyle

Shows date components in their numeric form. For example, "10/21/2015".

get · iOS 15.0+

omitted

TypeScript
static get omitted(): Date_FormatStyle_DateStyle
Swift declaration
static let omitted: Date.FormatStyle.DateStyle

Excludes the date part.

get · iOS 15.0+

complete

TypeScript
static get complete(): Date_FormatStyle_DateStyle
Swift declaration
static let complete: Date.FormatStyle.DateStyle

Shows the complete day. For example, "Wednesday, October 21, 2015".

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →