Guide
Unix timestamp seconds vs milliseconds
Distinguish 10-digit and 13-digit timestamps, convert units without moving the instant, and diagnose implausible dates.
by Tools in a Tab · Published on · Reviewed on
Short answer
Unix timestamps commonly use either seconds or milliseconds from
1970-01-01T00:00:00Z. Confusing the two moves the result by a factor of
1000.
The same instant in two units
2000-01-01T00:00:00Z
seconds: 946684800
milliseconds: 946684800000
The exact conversion is:
milliseconds = seconds × 1000
seconds = milliseconds ÷ 1000
If a millisecond value does not end in 000, division produces a fractional
second. 946684800123 ms is 946684800.123 s; truncating it drops 123 ms.
Can digit count identify the unit?
For dates near the present, ten digits usually indicates seconds and thirteen often indicates milliseconds. The rule fails for distant dates, negative values, truncated data, and other units such as microseconds. Use it to flag a possible mistake, not to replace API documentation.
Try both explicit interpretations in the timestamp converter. If one is plausible and the other exceeds the supported range, that is strong evidence, but the producer’s contract remains authoritative.
Typical warning signs
- The result falls near January 1970 after an incorrect early division.
- The date is extremely distant or outside the application’s range.
- Three digits of meaningful precision disappear.
- A JWT appears valid for thousands of years:
exp,iat, andnbfuseNumericDateseconds under RFC 7519.
Integration rule
Put the unit in the field name, type, or documentation: created_at_seconds,
timestamp_ms, or an ISO date with Z. Never rely only on number length. Before
comparing two values, normalize them to one unit and keep integer arithmetic
where possible to avoid binary rounding.