Timex.Timezone

Handles timezone lookups, conversion, diffing, and comparison.

Summary

convert(date, tz)

Convert a date to the given timezone (either TimezoneInfo or a timezone name)

diff(datetime, timezoneinfo)

Determine what offset is required to convert a date into a target timezone

exists?(zone)

Determines if a given zone name exists

get(tz, for \\ Timex.Date.now())

Gets timezone info for a given zone name and date. The date provided can either be an Erlang datetime tuple, or a DateTime struct, and if one is not provided, then the current date and time is returned

local()

Gets the local timezone configuration for the current date and time

local(date)

Gets the local timezone configuration for the provided date and time. The provided date and time can either be an Erlang datetime tuple, or a DateTime struct

Functions

convert(date, tz)

Specs:

Convert a date to the given timezone (either TimezoneInfo or a timezone name)

diff(datetime, timezoneinfo)

Specs:

Determine what offset is required to convert a date into a target timezone

exists?(zone)

Specs:

Determines if a given zone name exists

get(tz, for \\ Timex.Date.now())

Specs:

  • get(String.t, Timex.Date.datetime | %Timex.DateTime{calendar: term, day: term, hour: term, minute: term, month: term, ms: term, second: term, timezone: term, year: term} | nil) :: %Timex.TimezoneInfo{abbreviation: term, from: term, full_name: term, offset_std: term, offset_utc: term, until: term} | {:error, String.t}

Gets timezone info for a given zone name and date. The date provided can either be an Erlang datetime tuple, or a DateTime struct, and if one is not provided, then the current date and time is returned.

local()

Specs:

  • local :: %Timex.TimezoneInfo{abbreviation: term, from: term, full_name: term, offset_std: term, offset_utc: term, until: term}

Gets the local timezone configuration for the current date and time.

local(date)

Specs:

  • local(Timex.Date.datetime | %Timex.DateTime{calendar: term, day: term, hour: term, minute: term, month: term, ms: term, second: term, timezone: term, year: term}) :: %Timex.TimezoneInfo{abbreviation: term, from: term, full_name: term, offset_std: term, offset_utc: term, until: term}

Gets the local timezone configuration for the provided date and time. The provided date and time can either be an Erlang datetime tuple, or a DateTime struct.