Cldr.DateTime.Formatter.month
You're seeing just the function
month
, go back to Cldr.DateTime.Formatter module for more information.
Specs
month(Calendar.date(), integer(), Keyword.t()) :: String.t() | {:error, String.t()}
Returns the month
(format symbol M
) 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 monthlocale
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 inmonth/4
Format Symbol
The representation of the month is made in accordance with the following table:
Symbol | Example | Cldr Format |
---|---|---|
M | 9 | Single digit |
MM | "09" | Two digits |
MMM | "Sep" | Abbreviated |
MMMM | "September" | Wide |
MMMMM | "S" | Narrow |
Examples
iex> Cldr.DateTime.Formatter.month ~D[2019-09-08]
9
iex> Cldr.DateTime.Formatter.month ~D[2019-09-08], 2
"09"
iex> Cldr.DateTime.Formatter.month ~D[2019-09-08], 3
"Sep"
iex> Cldr.DateTime.Formatter.month ~D[2019-09-08], 4
"September"
iex> Cldr.DateTime.Formatter.month ~D[2019-09-08], 5
"S"
Specs
month(Calendar.date(), integer(), locale(), Cldr.backend(), Keyword.t()) :: String.t() | {:error, String.t()}