Cldr.DateTime.Formatter.period_am_pm
period_am_pm
, go back to Cldr.DateTime.Formatter module for more information.
Specs
period_am_pm(Calendar.time(), integer(), Keyword.t()) :: String.t() | {:error, String.t()}
Returns a localised version of am
or pm
(format symbol a
).
Arguments
time
is aTime
struct or any map that contains at least the key:second
n
in an integer between 1 and 5 that determines the format of the time periodlocale
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. The available option isperiod: :variant
which will use a veriant of localised "am" or "pm" if one is available
Notes
May be upper or lowercase depending on the locale and other options. The wide form may be the same as the short form if the “real” long form (eg ante meridiem) is not customarily used.
Format Symbol
The representation of the time period is made in accordance with the following table:
Symbol | Example | Cldr Format |
---|---|---|
a, aa, aaa | "am." | Abbreviated |
aaaa | "am." | Wide |
aaaaa | "am" | Narrow |
Examples
iex> Cldr.DateTime.Formatter.period_am_pm %{hour: 0, minute: 0}
"AM"
iex> Cldr.DateTime.Formatter.period_am_pm %{hour: 3, minute: 0}
"AM"
iex> Cldr.DateTime.Formatter.period_am_pm %{hour: 13, minute: 0}
"PM"
iex> Cldr.DateTime.Formatter.period_am_pm %{hour: 21, minute: 0}
"PM"
Specs
period_am_pm(Calendar.time(), integer(), locale(), Cldr.backend(), Keyword.t()) :: String.t() | {:error, String.t()}