10-digit timestamp, seconds
- Input
- 1700000000
- Expected output
- 2023-11-14T22:13:20.000Z
Below 1×10^12, the converter defaults to seconds; it is the format MySQL's UNIX_TIMESTAMP() returns.
convert unix timestamp from a log to a date
A bare number in a log, a database column or an API response does not say on its own whether it is seconds or milliseconds, nor in which timezone it should be read. The timestamp itself is always relative to UTC, with no timezone built in; it is the interpretation that decides whether 1700000000 turns into a morning hour or a night one.
Below 1×10^12, the converter defaults to seconds; it is the format MySQL's UNIX_TIMESTAMP() returns.
Three extra zeros, the same instant: it is the format JavaScript's Date.now() returns, and the converter switches unit automatically because the value crosses 1×10^12.
It is the largest number a signed 32-bit integer can hold; one second later, a legacy system still using that data type overflows back to a date in 1901.
It is the number of seconds (or milliseconds in JavaScript) elapsed since 1 January 1970 at 00:00:00 UTC. Also called Epoch time or POSIX time, it is the universal format for representing time instants in computing systems.
Count the digits: 10 digits usually means seconds (covering dates up to the year 2286), 13 digits usually means milliseconds. This converter automates that with its 1×10^12 cutoff, but counting digits by hand already settles it for most logs, because the three-order-of-magnitude gap is rarely ambiguous.
Because the Unix timestamp is always relative to UTC and carries no timezone at all; "local" is a conversion done afterwards, using the timezone of whoever is reading the screen. The instant in time is identical in both cases, only the wall-clock hour changes with the timezone.
Not the ones using 64-bit integers to store the timestamp: signed 64 bits only overflows billions of years in the future, so Linux, macOS and most current databases have already moved to it. The real risk sits in embedded firmware, older protocols and 32-bit code that was never updated.