One Logo Pool Ball
Foundation · IOS API REFERENCE

Date.FormatStyle.Symbol.Quarter

struct · iOS 15.0+ · SDK 27.1

struct Quarter

A type that specifies the format for the quarter in a date format style. The type ``Date/FormatStyle/Symbol/Quarter`` includes static factory variables that create custom ``Date/FormatStyle/Symbol/Quarter`` objects: |Factory variable|Description| |---|---| | ``abbreviated`` | Abbreviated quarter name. For example, `Q2`. | | ``narrow`` | Minimum number of digits that represents the numeric quarter. For example, `2`. | | ``oneDigit`` | One-digit numeric quarter. For example, `1`, `4`. | | ``twoDigits`` | Two-digit numeric quarter, zero-padded if necessary. For example, `01`, `04`. | | ``wide`` | Wide quarter name. For example, `2nd quarter`. | To customize the month format in a string representation of a `Date`, use ``Date/FormatStyle/quarter(_:)``. The following example shows a variety of ``Date/FormatStyle/Symbol/Quarter`` format styles applied to a date. ```swift let meetingDate = Date() // Oct 7, 2020 at 3:00 PM meetingDate.formatted(Date.FormatStyle().quarter(.abbreviated)) // Q4 meetingDate.formatted(Date.FormatStyle().quarter(.narrow)) // 4th quarter meetingDate.formatted(Date.FormatStyle().quarter(.oneDigit)) // 4 meetingDate.formatted(Date.FormatStyle().quarter(.twoDigits)) // 04 meetingDate.formatted(Date.FormatStyle().quarter(.wide)) // 4th quarter meetingDate.formatted(Date.FormatStyle().quarter()) // Q4 ``` 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 (6)

get · iOS 15.0+

abbreviated

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

Abbreviated quarter. For example `Q2`.

get · iOS 15.0+

wide

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

The quarter spelled out in full, for example `2nd quarter`.

get · iOS 15.0+

narrow

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

Narrow quarter. For example `2`.

get · iOS 18.0+

omitted

TypeScript
static get omitted(): Date_FormatStyle_Symbol_Quarter
Swift declaration
static let omitted: Date.FormatStyle.Symbol.Quarter

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

get · iOS 15.0+

oneDigit

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

Numeric: one digit quarter. For example `2`.

get · iOS 15.0+

twoDigits

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

Numeric: two digits with zero padding. For example `02`.

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →