Unix Timestamp: Seconds vs Milliseconds

The same integer means a different date depending on the unit: 1700000000 as seconds is 2023-11-14, but as milliseconds it's 1970-01-20 — the number alone never tells you which one it is.

Updated: 2026-08-11

Recognizing which unit you have

Current-era second timestamps have 10 digits (roughly 1.6–2.0 billion through the mid-2030s); current-era millisecond timestamps have 13 digits.

A resulting date that lands unexpectedly near 1970 or thousands of years in the future is the tell that seconds and milliseconds were mixed up somewhere in the pipeline.

Where each convention shows up

Seconds: Unix time() in most POSIX/C APIs, many JWT claims (exp, iat, nbf), Python's time.time().

Milliseconds: JavaScript's Date.now() and new Date(ms), Java's System.currentTimeMillis(), and many JSON web APIs that want sub-second precision without floating-point seconds.

Converting safely

Always convert explicitly rather than assuming — multiply seconds by 1000 to get JS-style milliseconds, or integer-divide milliseconds by 1000 to get seconds.

JavaScript

js
new Date(unixSeconds * 1000)       // seconds -> Date
Math.floor(Date.now() / 1000)      // ms -> seconds

Engineering Notes

i
When designing an API, name the field with its unit (expiresAtMs, issuedAtSeconds) rather than leaving it implicit — this is the single most common source of off-by-1000 date bugs.

Related Concepts

Unix Timestamp

Related Tools

Related Reference