Convertools Dev
All tools

Unix Timestamp in Elixir

Look up the current epoch time and convert between Unix seconds and UTC dates in Elixir.

Get the current timestamp

IO.puts(System.system_time(:second))

Timestamp to date

IO.puts(DateTime.from_unix!(1_700_000_000) |> DateTime.to_iso8601())

Date to timestamp

{:ok, utc, 0} = DateTime.from_iso8601("2023-11-14T22:13:20Z")
IO.puts(DateTime.to_unix(utc))

Open 1700000000 in the converter

Current Unix time

Seconds—
Milliseconds—
UTC
—
My time zone
—

Official reference ↗

Free to use. Your input stays in this browser.

How to use it

  1. Copy the current-time example into your Elixir environment to read Unix seconds.
  2. Run the second example to display 1700000000 as a UTC date.
  3. Run the last example to convert that date back into seconds.

DateTime.from_unix! and DateTime.to_unix default to seconds. Pass :millisecond explicitly when working with a millisecond value.