How to use it
- Paste a timestamp or a date
Seconds, milliseconds, micro- or nanoseconds are recognised by their length.
- Read every format
ISO 8601, RFC 2822, local time, relative time and the other units.
- Add a time zone
Pick any zone to see the same moment there, then copy the value you need.
What a Unix timestamp is
A Unix timestamp counts the seconds since 1 January 1970 00:00:00 UTC (the "epoch"), ignoring leap seconds. It is the same number everywhere on Earth at the same moment, which is why servers, databases and APIs use it: there is no time zone to get wrong until you display it.
Seconds, milliseconds or nanoseconds?
Systems disagree on the unit. Unix tools, PHP, Python's time.time() and most APIs use seconds (10 digits today). JavaScript's Date.now() and Java use milliseconds (13 digits). Some databases and tracing tools use microseconds (16), and Go and InfluxDB use nanoseconds (19). The converter guesses from the length and lets you override it. If a date comes out in 1970 or in the year 50,000, the unit is wrong.
The year 2038 problem
A signed 32-bit integer can hold seconds only up to 2,147,483,647, which is 19 January 2038 03:14:07 UTC. Software that still stores time in 32 bits will wrap around to 1901 after that. Modern systems use 64 bits, but old embedded devices, file formats and database columns (INT instead of BIGINT) are worth checking.
Getting the current timestamp in code
- JavaScript:
Math.floor(Date.now() / 1000) - Python:
int(time.time()) - PHP:
time()· Go:time.Now().Unix() - Shell:
date +%s· PostgreSQL:extract(epoch from now())· MySQL:UNIX_TIMESTAMP()
Reading a time-ordered id? The UUID inspector extracts the timestamp from UUID v7 and ULID. Scheduling a job? Check its next runs with the cron explainer.