Unix timestamp converter
Paste a timestamp or a date. It works out which you gave it and shows the rest.
Nothing you paste here is sent anywhere - which matters more than usual for this tool, because the timestamps people convert usually come out of a production log.
Seconds, milliseconds, or something else
A Unix timestamp counts from midnight UTC on 1 January 1970. The trouble is that nothing in the number says what its units are, and a milliseconds value read as seconds lands you in the year 56000.
This tool decides by size and tells you which it chose. Anything under 100,000,000,000 is read as seconds - as seconds that boundary is the year 5138, and as milliseconds it is 1973, so the split is unambiguous for any date anyone is actually working with. Values above 100,000,000,000,000 are read as microseconds, which is what several databases export.
| Language | Seconds | Milliseconds |
|---|---|---|
| JavaScript | Math.floor(Date.now()/1000) |
Date.now() |
| PHP | time() |
(int)(microtime(true)*1000) |
| Python | int(time.time()) |
int(time.time()*1000) |
| MySQL | UNIX_TIMESTAMP() |
- |
The 2038 problem
A signed 32-bit integer runs out on 19 January 2038, at 03:14:07 UTC. Anything still storing timestamps in a 32-bit signed column wraps to 1901 at that moment.
This is not a curiosity if you maintain older systems: it is reachable today by any code that adds twenty years to a date. Timestamps have been 64-bit in most places for years, but database columns and embedded systems are where it survives.
Negative timestamps
Dates before 1970 are negative and are handled here. They are also where implementations quietly disagree - some languages reject them outright, and Windows historically did - so if you are storing pre-1970 dates, test rather than assume.