Convertools Dev
All tools

Unix Timestamp in Lua

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

Get the current timestamp

print(os.time())

Timestamp to date

print(os.date("!%Y-%m-%dT%H:%M:%SZ", 1700000000))

Date to timestamp

print(os.time { year = 2023, month = 11, day = 14, hour = 22, min = 13, sec = 20 })

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 Lua 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.

On Unix-like systems os.time() returns Unix seconds. A leading ! makes os.date format in UTC. Run the table-based example as TZ=UTC lua example.lua because os.time(table) reads local time.