Cldr.DateTime.Formatter.day_of_week
You're seeing just the function
day_of_week
, go back to Cldr.DateTime.Formatter module for more information.
Specs
day_of_week(Calendar.date(), integer(), Keyword.t()) :: String.t() | {:error, String.t()}
Returns the local day of week (format symbol e
) as a
number or name.
Arguments
date
is aDate
struct or any map that contains at least the keys:year
,:month
,:day
and:calendar
n
in an integer between 1 and 6 that determines the format of the day of weeklocale
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 inday_of_week/4
Notes
Returns the same as format symbol E
except that it adds a
numeric value that will depend on the local starting day
of the week.
Format Symbol
The representation of the time period is made in accordance with the following table:
Symbol | Example | Cldr Format |
---|---|---|
e | 2 | Single digit |
ee | "02" | Two digits |
eee | "Tue" | Abbreviated |
eeee | "Tuesday" | Wide |
eeeee | "T" | Narrow |
eeeeee | "Tu" | Short |
Examples
iex> Cldr.DateTime.Formatter.day_of_week ~D[2017-08-15], 3
"Tue"
iex> Cldr.DateTime.Formatter.day_of_week ~D[2017-08-15], 4
"Tuesday"
iex> Cldr.DateTime.Formatter.day_of_week ~D[2017-08-15], 5
"T"
iex> Cldr.DateTime.Formatter.day_of_week ~D[2017-08-15], 6
"Tu"
iex> Cldr.DateTime.Formatter.day_of_week ~D[2017-08-15], 1
"2"
iex> Cldr.DateTime.Formatter.day_of_week ~D[2017-08-15], 2
"02"
Specs
day_of_week(Calendar.date(), integer(), locale(), Cldr.backend(), Keyword.t()) :: String.t() | {:error, String.t()}