View Source Cldr.Strftime (Cldr Strftime Options generator for Calendar.strftime/3 v1.0.1)
Summary
Functions
Returns a keyword list of options than can be applied to
NimbleStrftime.format/3.
Functions
Returns a keyword list of options than can be applied to
NimbleStrftime.format/3.
The hex package nimble_strftime
provides a format/3 function to format dates, times and datetimes.
It takes a set of options that can return day, month and am/pm names.
strftime_options! returns a keyword list than can be used as these
options to return localised names for days, months and am/pm.
Arguments
localeis any locale returned byCldr.known_locale_names/1. The default isCldr.get_locale/0optionsis a set of keyword options. The default is[]
Options
:formatdetermines the format of the date, time or date time. The options are:short,:medium,:longand:full. The default is:medium.
Example
=> Cldr.Strftime.strftime_options!
[
am_pm_names: #Function<0.117825700/1 in MyApp.Cldr.Calendar.strftime_options!/2>,
month_names: #Function<1.117825700/1 in MyApp.Cldr.Calendar.strftime_options!/2>,
abbreviated_month_names: #Function<2.117825700/1 in MyApp.Cldr.Calendar.strftime_options!/2>,
day_of_week_names: #Function<3.117825700/1 in MyApp.Cldr.Calendar.strftime_options!/2>,
abbreviated_day_of_week_names: #Function<4.117825700/1 in MyApp.Cldr.Calendar.strftime_options!/2>,
preferred_date: "%b %d, %Y",
preferred_time: "%H:%M:%S %p",
preferred_datetime: "%b %d, %Y, %H:%M:%S %p"
]Typical usage from Elixir 1.11
iex> Calendar.strftime ~U[2019-08-26 13:52:06.0Z], "%x", Cldr.Strftime.strftime_options!
"Aug 26, 2019"
iex> Calendar.strftime ~U[2019-08-26 13:52:06.0Z], "%X", Cldr.Strftime.strftime_options!
"13:52:06 PM"
iex> Calendar.strftime ~U[2019-08-26 13:52:06.0Z], "%c", Cldr.Strftime.strftime_options!
"Aug 26, 2019, 13:52:06 PM"