Calendar.TimeZoneData
Summary
canonical_zone?(name) | Takes the name of a zone. Returns true if zone exists and is canonical. Otherwise false |
canonical_zone_list() | Like zone_list, but excludes aliases for zones |
leap_seconds() | List of know leap seconds as DateTime structs |
leap_seconds_erl() | List of known leap seconds in erlang tuple format in UTC |
links() | Returns a map of links. Also known as aliases |
periods(zone_name) | A list of pre-compiled periods for a given zone name |
periods_for_time(zone_name, time_point, time_type \\ :wall) | |
tzdata_version() | Returns tzdata release version as a string |
zone_alias?(name) | Takes the name of a zone. Returns true if zone exists and is an alias. Otherwise false |
zone_alias_list() | A list of aliases for zone names. For instance Europe/Jersey is an alias for Europe/London. Aliases are also known as linked zones |
zone_exists?(name) | Takes the name of a zone. Returns true zone exists. Otherwise false |
zone_list() | zone_list provides a list of all the zone names that can be used with DateTime. This includes aliases |
zone_lists_grouped() | Returns a map with keys being group names and the values lists of time zone names. The group names mirror the file names used by the tzinfo database |
Functions
Takes the name of a zone. Returns true if zone exists and is canonical. Otherwise false.
iex> Calendar.TimeZoneData.canonical_zone? "Europe/London"
true
iex> Calendar.TimeZoneData.canonical_zone? "Europe/Jersey"
false
Like zone_list, but excludes aliases for zones.
List of know leap seconds as DateTime structs
Example:
iex> TimeZoneData.leap_seconds |> Enum.take(3)
[%Calendar.DateTime{abbr: "UTC", day: 31, hour: 23, min: 59, month: 12, sec: 60, std_off: 0, timezone: "Etc/UTC", usec: 0, utc_off: 0, year: 1971},
%Calendar.DateTime{abbr: "UTC", day: 30, hour: 23, min: 59, month: 6, sec: 60, std_off: 0, timezone: "Etc/UTC", usec: 0, utc_off: 0, year: 1972},
%Calendar.DateTime{abbr: "UTC", day: 31, hour: 23, min: 59, month: 12, sec: 60, std_off: 0, timezone: "Etc/UTC", usec: 0, utc_off: 0, year: 1972}]
List of known leap seconds in erlang tuple format in UTC.
Example:
iex> TimeZoneData.leap_seconds_erl |> Enum.take(3)
[{{1971, 12, 31}, {23, 59, 60}}, {{1972, 6, 30}, {23, 59, 60}}, {{1972, 12, 31}, {23, 59, 60}}]
Returns a map of links. Also known as aliases.
iex> Calendar.TimeZoneData.links["Europe/Jersey"]
"Europe/London"
A list of pre-compiled periods for a given zone name.
Returns tzdata release version as a string.
Example:
Calendar.TimeZoneData.tzdata_version
"2014i"
Takes the name of a zone. Returns true if zone exists and is an alias. Otherwise false.
iex> Calendar.TimeZoneData.zone_alias? "Europe/Jersey"
true
iex> Calendar.TimeZoneData.zone_alias? "Europe/London"
false
A list of aliases for zone names. For instance Europe/Jersey is an alias for Europe/London. Aliases are also known as linked zones.
Takes the name of a zone. Returns true zone exists. Otherwise false.
iex> Calendar.TimeZoneData.zone_exists? "Pacific/Auckland"
true
iex> Calendar.TimeZoneData.zone_exists? "America/Sao_Paulo"
true
iex> Calendar.TimeZoneData.zone_exists? "Europe/Jersey"
true
zone_list provides a list of all the zone names that can be used with DateTime. This includes aliases.
Returns a map with keys being group names and the values lists of time zone names. The group names mirror the file names used by the tzinfo database.