Unix timestamp: seconds vs milliseconds
Epoch seconds (10 digits) vs milliseconds (13 digits). Mixing them shifts dates by a factor of 1000.
Unix time is seconds since 1970-01-01 UTC. JavaScript Date.now() is milliseconds, so you see 13-digit values in browsers and many APIs. A 10-digit value is almost certainly seconds.
Treat a 13-digit stamp as milliseconds or you land in the year 50,000+. Treat a 10-digit stamp as milliseconds and you land in 1970. The converter accepts both if you pick the unit.
ISO 8601 strings avoid the whole mess when two systems can speak them. Use epoch only when the API demands a number. Leap seconds are ignored in Unix time; civil clocks still follow TZ data.
Ten digits around 1700000000 are seconds. Thirteen digits around 1700000000000 are milliseconds. Mix them and the date jumps by about three decades or lands in 1970. APIs disagree: some JSON fields are seconds, Date.now() is milliseconds. This page is that split. The converter detects the length and still lets you override it.
| Trait | Seconds | Milliseconds |
|---|---|---|
| Digits (this century) | About 10 | About 13 |
| JS Date.now() | No | Yes |
| Mix-up result | Date lands in 1970 if treated as ms | Date lands in year 50k+ if treated as s |
FAQ
How do I tell them apart?
Count digits. ~10 is seconds, ~13 is milliseconds, for dates in this century.
Date.now() unit?
Milliseconds.
