Cldr.DateTime.Formatter.zone_iso
You're seeing just the function
zone_iso
, go back to Cldr.DateTime.Formatter module for more information.
Specs
zone_iso(Calendar.time(), integer(), Keyword.t()) :: String.t() | {:error, String.t()}
Returns the ISO zone offset (format symbol x
) part of a DateTime
or Time
,
This is the ISO8601 format with hours, minutes and optional seconds fields but with no "Z" as the identifier if the timezone offset is 0.
Arguments
time
is aTime
struct or any map that contains at least the:utc_offset
and:std_offset
keys of the format used byTime
n
is the specific non-location timezone format and is in the range1..4
locale
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 inzone_iso/4
Format Symbol
The representation of the timezone offset
is made in accordance with the following
table:
Symbol | Results | Description |
---|---|---|
x | "+0100" | ISO8601 Basic Format with hours and optional minutes |
xx | "-0800" | ISO8601 Basic Format with hours and minutes |
xxx | "+01:00" | ISO8601 Extended Format with hours and minutes |
xxxx | "+010059" | ISO8601 Basic Format with hours and minutes, optional seconds |
xxxxx | "+01:00:10" | ISO8601 Extended Format with hours and minutes, optional seconds |
Examples
iex> Cldr.DateTime.Formatter.zone_iso %{time_zone: "Etc/UTC",
...> utc_offset: 3610, std_offset: 0}, 1
"+01"
iex> Cldr.DateTime.Formatter.zone_iso %{time_zone: "Etc/UTC",
...> utc_offset: 3610, std_offset: 0}, 2
"+0100"
iex> Cldr.DateTime.Formatter.zone_iso %{time_zone: "Etc/UTC",
...> utc_offset: 3610, std_offset: 0}, 3
"+01:00"
iex> Cldr.DateTime.Formatter.zone_iso %{time_zone: "Etc/UTC",
...> utc_offset: 3610, std_offset: 0}, 4
"+010010"
iex> Cldr.DateTime.Formatter.zone_iso %{time_zone: "Etc/UTC",
...> utc_offset: 3610, std_offset: 0}, 5
"+01:00:10"
iex> Cldr.DateTime.Formatter.zone_iso %{time_zone: "Etc/UTC",
...> utc_offset: 0, std_offset: 0}, 5
"+00:00"
iex> Cldr.DateTime.Formatter.zone_iso %{time_zone: "Etc/UTC",
...> utc_offset: 0, std_offset: 0}, 4
"+0000"
iex> Cldr.DateTime.Formatter.zone_iso %{time_zone: "Etc/UTC",
...> utc_offset: 0, std_offset: 0}, 3
"+00:00"
iex> Cldr.DateTime.Formatter.zone_iso %{time_zone: "Etc/UTC",
...> utc_offset: 0, std_offset: 0}, 2
"+0000"
iex> Cldr.DateTime.Formatter.zone_iso %{time_zone: "Etc/UTC",
...> utc_offset: 0, std_offset: 0}, 1
"+00"
Specs
zone_iso(Calendar.time(), integer(), locale(), Cldr.backend(), Keyword.t()) :: String.t() | {:error, String.t()}