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

# Date.FormatStyle.Symbol.Era

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

```
struct Era
```

## Overview

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

|Factory variable                                                                               |Description                                                                  |
|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
|``doc://com.apple.foundation/documentation/Foundation/Date/FormatStyle/Symbol/Era/abbreviated``|An abbreviated representation of an era. For example, `AD`, `BC`.            |
|``doc://com.apple.foundation/documentation/Foundation/Date/FormatStyle/Symbol/Era/narrow``     |A narrow era representation. For example, `A`, `B`.                          |
|``doc://com.apple.foundation/documentation/Foundation/Date/FormatStyle/Symbol/Era/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 [`era(_:)`](/documentation/Foundation/Date/FormatStyle/era(_:)). The following example shows a variety of [`Date.FormatStyle.Symbol.Era`](/documentation/Foundation/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`](/documentation/Foundation/Date/FormatStyle/Symbol/Era/abbreviated) static variable is the default format.

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

## Topics

### Modifying an Era

[`static var abbreviated: Date.FormatStyle.Symbol.Era`](/documentation/Foundation/Date/FormatStyle/Symbol/Era/abbreviated)

An abbreviated representation of an era.

[`static var narrow: Date.FormatStyle.Symbol.Era`](/documentation/Foundation/Date/FormatStyle/Symbol/Era/narrow)

A narrow representation of an era.

[`static var wide: Date.FormatStyle.Symbol.Era`](/documentation/Foundation/Date/FormatStyle/Symbol/Era/wide)

A full representation of an era.

### Comparing an Era

[`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.Era`](/documentation/Foundation/Date/FormatStyle/Symbol/Era/omitted)

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

## Relationships

### Conforms To

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

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

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

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

---

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)