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
Specs:
- convert(date :: Timex.DateTime.t, tz :: Timex.TimezoneInfo.t | String.t) :: Timex.DateTime.t
Convert a date to the given timezone (either TimezoneInfo or a timezone name)
Specs:
- diff(date :: Timex.DateTime.t, tz :: Timex.TimezoneInfo.t) :: integer
Determine what offset is required to convert a date into a target timezone
Specs:
- exists?(String.t) :: boolean
Determines if a given zone name exists
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.
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.
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.