Unix timestamp
Convert timestamps to readable dates and back.
Now
seconds
milliseconds
Timestamp → date
—
Date → timestamp
In seconds
—
Current timestamp in other programming languages
| Language | Seconds | Milliseconds |
|---|---|---|
| JavaScript | Math.floor(Date.now() / 1000) |
Date.now() |
| Python | int(time.time()) |
time.time_ns() // 1_000_000 |
| PostgreSQL | SELECT extract(epoch FROM now())::bigint; |
SELECT (extract(epoch FROM now()) * 1000)::bigint; |
| MySQL | SELECT UNIX_TIMESTAMP(); |
SELECT ROUND(UNIX_TIMESTAMP(NOW(3)) * 1000); |
| Shell (Linux) | date +%s |
date +%s%3N |
| PHP | time() |
(int) (microtime(true) * 1000) |
With automatic detection, values from 100,000,000,000 up are read as milliseconds. Choose the unit for dates before 1973 or after 5138.
Unix time counts seconds since January 1, 1970 00:00:00 UTC, without leap seconds, and is the same worldwide: the time zone only changes how the date is displayed.