Cldr.DateTime.Formatter.quarter
You're seeing just the function
quarter
, go back to Cldr.DateTime.Formatter module for more information.
Specs
quarter(Calendar.date(), integer(), Keyword.t()) :: String.t() | {:error, String.t()}
Returns the quarter
(format symbol Q
) of a date
for given locale.
Arguments
date
is aDate
struct or any map that contains at least the keys:month
and:calendar
n
in an integer between 1 and 5 that determines the format of the quarterlocale
is any valid locale name returned byCldr.known_locale_names/0
or aCldr.LanguageTag
struct. The default isCldr.get_locale/0
options
is aKeyword
list of options. There are no options used inquarter/5
Format Symbol
The representation of the quarter is made in accordance with the following table:
Symbol | Example | Cldr Format |
---|---|---|
Q | 2 | Single digit |
"02" | Two digits | |
QQQ | "Q2" | Abbreviated |
QQQQ | "2nd quarter" | Wide |
QQQQQ | "2" | Narrow |
Examples
iex> Cldr.DateTime.Formatter.quarter ~D[2017-04-01], 1
2
iex> Cldr.DateTime.Formatter.quarter ~D[2017-04-01], 2
"02"
iex> Cldr.DateTime.Formatter.quarter ~D[2017-04-01], 3
"Q2"
iex> Cldr.DateTime.Formatter.quarter ~D[2017-04-01], 4
"2nd quarter"
iex> Cldr.DateTime.Formatter.quarter ~D[2017-04-01], 5
"2"
Specs
quarter(Calendar.date(), integer(), locale(), Cldr.backend(), Keyword.t()) :: String.t() | {:error, String.t()}