Cldr.Time.hour_format_from_locale
You're seeing just the function
hour_format_from_locale
, go back to Cldr.Time module for more information.
Return the preferred time format for a locale.
Arguments
language_tag
is any language tag returned byCldr.Locale.new/2
or anylocale_name
returned byCldr.known_locale_names/1
Returns
- The hour format as an atom to be used for localization purposes. The
return value is used as a function name in
Cldr.DateTime.Formatter
Notes
The
hc
key of theu
extension is honoured and will override the default preferences for a locale or territory. See the last example below.Different locales and territories present the hour of day in different ways. These are represented in
Cldr.DateTime.Formatter
in the following way:
Symbol | Midn. | Morning | Noon | Afternoon | Midn. |
---|---|---|---|---|---|
h | 12 | 1...11 | 12 | 1...11 | 12 |
K | 0 | 1...11 | 0 | 1...11 | 0 |
H | 0 | 1...11 | 12 | 13...23 | 0 |
k | 24 | 1...11 | 12 | 13...23 | 24 |
Examples
iex> Cldr.Time.hour_format_from_locale "en-AU"
:hour_1_12
iex> Cldr.Time.hour_format_from_locale "fr"
:hour_0_23
iex> Cldr.Time.hour_format_from_locale "fr-u-hc-h12"
:hour_1_12
Link to this function