---
title: "era(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/date/formatstyle/era(_:)"
---

# era(_:)

Modifies the date format style to use the specified era format style.

## Declaration

```swift
func era(_ format: Date.FormatStyle.Symbol.Era = .abbreviated) -> Date.FormatStyle
```

## Parameters

- `format`: The era format style applied to the date format style.

## Return Value

Return Value A date format style modified to include the specified era style.

## Discussion

Discussion Possible values of Date.FormatStyle.Symbol.Era include abbreviated, narrow, and wide. This example shows a variety of Date.FormatStyle.Symbol.Era format styles applied to a date: 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 you don’t provide a format, the abbreviated static variable is the default format. For more information about formatting dates, see Date.FormatStyle.

## See Also

### Specifying the Date Format

- [day(_:)](foundation/date/formatstyle/day(_:).md)
- [dayOfYear(_:)](foundation/date/formatstyle/dayofyear(_:).md)
- [month(_:)](foundation/date/formatstyle/month(_:).md)
- [quarter(_:)](foundation/date/formatstyle/quarter(_:).md)
- [week(_:)](foundation/date/formatstyle/week(_:).md)
- [weekday(_:)](foundation/date/formatstyle/weekday(_:).md)
- [year(_:)](foundation/date/formatstyle/year(_:).md)
- [Date.FormatStyle.DateStyle](foundation/date/formatstyle/datestyle.md)
