Cldr.DateTime.Formatter.period_am_pm

You're seeing just the function period_am_pm, go back to Cldr.DateTime.Formatter module for more information.
Link to this function

period_am_pm(period_am_pm, n \\ 1, options \\ [])

View Source

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 a Time 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 period

  • locale is any valid locale name returned by Cldr.known_locale_names/0 or a Cldr.LanguageTag struct. The default is Cldr.get_locale/0

  • options is a Keyword list of options. The available option is period: :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:

SymbolExampleCldr 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"
Link to this function

period_am_pm(time, n, locale, backend, options \\ [])

View Source

Specs

period_am_pm(Calendar.time(), integer(), locale(), Cldr.backend(), Keyword.t()) ::
  String.t() | {:error, String.t()}