FastLocalDatetime (FastLocalDatetime v1.0.1) View Source
Fast conversions of UTC epoch timestamps (Unix timestamps) into a local DateTime.
Link to this section Summary
Functions
Convert a UTC epoch timestamp (Unix timestamp) to a DateTime in the given timezone.
Link to this section Functions
Specs
unix_to_datetime(timestamp, timezone) ::
{:ok, DateTime.t()} | {:error, :not_found}
when timestamp: integer(), timezone: String.t()
Convert a UTC epoch timestamp (Unix timestamp) to a DateTime in the given timezone.
iex> {:ok, dt} = unix_to_datetime(1522888537, "America/New_York")
iex> dt
#DateTime<2018-04-04 20:35:37-04:00 EDT America/New_York>
iex> unix_to_datetime(1522888537, "not found")
{:error, :not_found}