One Logo Pool Ball
Foundation · IOS API REFERENCE

Date.FormatStyle.Symbol.Era

struct · iOS 15.0+ · SDK 27.1

struct Era

A type that specifies a format for the era in a date format style. The type ``Date/FormatStyle/Symbol/Era`` includes static factory variables that create custom ``Date/FormatStyle/Symbol/Era`` objects. |Factory variable|Description| |---|---| | ``abbreviated`` | An abbreviated representation of an era. For example, `AD`, `BC`. | | ``narrow`` | A narrow era representation. For example, `A`, `B`. | | ``wide`` | A full representation of an era. For example, `Anno Domini`, `Before Christ`. | To customize the era format in a string representation of a `Date`, use ``Date/FormatStyle/era(_:)``. The following example shows a variety of ``Date/FormatStyle/Symbol/Era`` format styles applied to a date. ```swift let meetingDate = Date() // Feb 9, 2021 at 3:00 PM meetingDate.formatted(Date.FormatStyle().era(.abbreviated)) // AD meetingDate.formatted(Date.FormatStyle().era(.narrow)) // A meetingDate.formatted(Date.FormatStyle().era(.wide)) // Anno Domini meetingDate.formatted(Date.FormatStyle().era()) // AD ``` If no format is specified as a parameter, the ``abbreviated`` static variable is the default format. For more information about formatting dates, see the ``Date/FormatStyle``.

Members (4)

get · iOS 15.0+

abbreviated

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

Abbreviated Era name. For example, "AD", "Reiwa", "令和".

get · iOS 15.0+

wide

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

Wide era name. For example, "Anno Domini", "Reiwa", "令和".

get · iOS 15.0+

narrow

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

Narrow era name. For example, For example, "A", "R", "R".

get · iOS 18.0+

omitted

TypeScript
static get omitted(): Date_FormatStyle_Symbol_Era
Swift declaration
static let omitted: Date.FormatStyle.Symbol.Era

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

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →