Unix Timestamps Explained: Seconds, Epoch and UTC
By SyncBuilder
If you have ever opened an API response and found a date that looks like a random pile of digits, you have met the Unix timestamp. It is one of the most common ways computers store a moment in time, and once you understand it, those numbers stop being mysterious.
What is a Unix timestamp?
A Unix timestamp is simply the number of seconds that have passed since the Unix epoch, which is 1970-01-01 00:00:00 UTC. Because it is measured in UTC, it is timezone-independent, compact, and easy to compare and sort. That is exactly why APIs and databases love it. A millisecond variant, used by JavaScript and many other systems, is the same value multiplied by 1000.
What to watch when converting
- Seconds vs milliseconds: a 10-digit number is usually seconds, while a 13-digit number is milliseconds.
- UTC vs local time: the stored value is always UTC, so decide whether you want to display it in UTC or in the viewer's local timezone.
- Leading zeros: do not strip them or reformat blindly, or you can change the value you are reading.
- Negative values: timestamps before 1970 are perfectly valid and are represented as negative numbers.
Mixing seconds and milliseconds is one of the most common integration bugs. If a value is off by a factor of 1000, it is almost always a seconds/milliseconds mismatch. And on 32-bit systems, watch for the year 2038 problem, when the second counter overflows a signed 32-bit integer.
Want to check a value without leaving your desk? Our free Timestamp Converter turns timestamps into human dates and back, in both seconds and milliseconds, right in your browser.
Try the free tool