around the script tag below to activate site-wide auto ads. --> Skip to content

Understanding Unix Timestamps and Time Zones

Every "why is this timestamp off by several hours" bug traces back to the same root cause: someone assumed a timestamp carried time zone information when it didn't, or forgot that it did.

What a Unix timestamp actually is

A Unix timestamp is simply the number of seconds elapsed since January 1, 1970, 00:00:00 UTC — a single, unambiguous point in time, with no time zone attached to the number itself. 1752480000 refers to the exact same instant everywhere on Earth; it's only when that number gets converted into a human-readable date that a time zone enters the picture.

Why this design avoids a whole category of bugs

Storing "3:00 PM" without a time zone is ambiguous — 3:00 PM in New York is a different instant than 3:00 PM in Tokyo. Storing a Unix timestamp sidesteps this entirely, because it's already time-zone-independent by definition. This is why databases and APIs overwhelmingly store timestamps in this format (or the equivalent UTC datetime) rather than storing a "local time" directly.

Where the confusion actually happens

The bugs show up at the conversion boundary — when a timestamp is displayed to a user. If code forgets to convert from UTC to the user's local time zone, timestamps appear shifted by whatever the UTC offset is. This is also why daylight saving time transitions cause a predictable wave of scheduling bugs twice a year: the UTC offset for a given time zone literally changes.

Milliseconds vs seconds: a common off-by-1000 bug

Language/contextCommon unit
Unix/Linux systems, most APIsSeconds
JavaScript's Date.now()Milliseconds
Some databasesMicroseconds or nanoseconds

Passing a millisecond timestamp into a function expecting seconds (or vice versa) produces a date wildly in the past or far in the future — a surprisingly common bug precisely because both look like plausible numbers at a glance.

Frequently asked questions

No, standard Unix time ignores leap seconds entirely, treating every day as exactly 86,400 seconds — a deliberate simplification that keeps the format predictable for everyday use.

A 10-digit number is typically a timestamp in seconds; a 13-digit number is the same timestamp in milliseconds — multiplying or dividing by 1000 converts between them.

Conclusion

A Unix timestamp is a time-zone-free anchor point — precise and unambiguous by design. Confusion almost always happens at the conversion step, not in the timestamp itself, so double-check units (seconds vs milliseconds) and time zone handling whenever displaying one to a user.

Convert one instantly with the Timestamp Converter.