Unix timestamp: seconds or milliseconds?
Count the digits. A 10 digit number like 1700000000 is seconds; a 13 digit number like 1700000000000 is milliseconds. Both mean 2023-11-14T22:13:20.000Z.
Last reviewed 2026-11-04.
Worked example
Paste 1700000000 into the converter above with the unit on seconds, then paste 1700000000000 with the unit on milliseconds. Both give 2023-11-14T22:13:20.000Z. If you pick the wrong unit, the date is wildly wrong: 1700000000000 read as seconds is a date tens of thousands of years from now.
The digit rule
Seconds are 10 digits from 2001-09-09T01:46:40.000Z (1,000,000,000) until 2286-11-20T17:46:40.000Z (10,000,000,000). Milliseconds are 13 digits across the same period. The rule holds for any date between those two moments, which covers everything you will meet today. Microseconds are 16 digits and nanoseconds 19.
Which languages use which
| Language | Call | Unit |
|---|---|---|
| JavaScript | Date.now() | milliseconds |
| Python | time.time() | seconds (float) |
| Go | time.Now().Unix() | seconds (UnixMilli() for ms) |
| Java | System.currentTimeMillis() | milliseconds |
| PostgreSQL | extract(epoch from now()) | seconds (float) |
| MySQL | UNIX_TIMESTAMP() | seconds |
Common mistakes
- Sending JavaScript milliseconds to an API that expects seconds, such as the JWT
expclaim. - Dividing by 1000 with integer math in the wrong place and losing the fractional second.
- Mixing local time and UTC. A timestamp has no zone; only the display does.
More on conversions: timestamps in JS, Python, Go and SQL.
Running this on a server
Store timestamps in UTC on the server and convert on display. The hosting guide compares where to run a small API that does it.
Frequently asked questions
How do I know if a timestamp is in milliseconds?
It has 13 digits for any date from September 2001 to November 2286. Seconds have 10.
What is the epoch?
1970-01-01T00:00:00Z, the zero point of Unix time.
How do I convert milliseconds to seconds?
Divide by 1000. In JavaScript use Math.floor(Date.now() / 1000).
Sources
- MDN: Date.now() checked 2026-11-04
- Python docs: time.time() checked 2026-11-04
- Go docs: time.Time.Unix checked 2026-11-04