Guide / precision

Unix seconds vs milliseconds

Compare 10-digit and 13-digit timestamps, unit detection, precision, storage limits and conversion errors.

The thousand-fold difference

Seconds count whole seconds after the epoch. Milliseconds count thousandths of a second, so the same instant has a value 1,000 times larger. For example, 1700000000 s and 1700000000000 ms are both 2023-11-14T22:13:20Z.

Why digit count is only a hint

Current positive values are commonly 10 digits in seconds and 13 in milliseconds. Near the epoch they are shorter. Negative values include a sign. Far-future values grow longer. Reliable software should accept an explicit unit or show what it detected.

Precision and safe integers

JavaScript numbers exactly represent integers only through Number.MAX_SAFE_INTEGER. This site uses BigInt while changing epoch units so 16- and 19-digit inputs are not rounded before their millisecond date representation is calculated.

Compare four representations of the same instant

UnitValueScale relative to seconds
Seconds17000000001
Milliseconds17000000000001,000
Microseconds17000000000000001,000,000
Nanoseconds17000000000000000001,000,000,000

All four produce 2023-11-14T22:13:20Z. Multiplying by 1,000 changes the unit, not the instant. It does not create additional measured precision. Try these values in the converter with the unit selected explicitly.

Diagnose a date near 1970 or far in the future

If a modern event unexpectedly appears in January 1970, a seconds value may have been interpreted as milliseconds. If it appears tens of thousands of years away, a milliseconds value may have been interpreted as seconds. Before changing the number, check the original system's field documentation. Ten and thirteen digits are clues for contemporary dates, not universal validation rules.

For historical data, 1000 seconds is 1970-01-01 00:16:40 UTC; 1000 milliseconds is 00:00:01 UTC. Both are valid. Choose the unit in the batch converter when every row follows the same source specification.

Rounding is a data decision

1700000000123 milliseconds contains 123 milliseconds beyond the whole second. Converting it to whole seconds discards that fraction. This site rounds down to the beginning of the containing unit: -1 nanosecond belongs to millisecond -1, not millisecond zero.

Fine-unit output preserves the integer input exactly. ISO calendar output is limited to milliseconds and displays a precision notice when a finer remainder exists. Keep the original integer when auditing a database with microsecond or nanosecond timestamps; a readable date alone is insufficient for an exact round trip.

Standards and runtime references

Tools / 01—06

More timestamp tools

Each route starts with a specific input and gives a specific answer.