Developer / 5 min read
Unix Timestamp Explained for Beginners
A plain-English explanation of Unix timestamps, seconds vs milliseconds, local time, and UTC.
What is a Unix timestamp?
A Unix timestamp is a number that represents a moment in time. It counts how much time has passed since January 1, 1970 at 00:00:00 UTC.
Developers use timestamps because numbers are easy to store, compare, and send between systems. A database, API, and browser can all understand the same moment when the timestamp is handled correctly.
Seconds vs milliseconds
Some systems use seconds, while JavaScript often uses milliseconds. This is why one timestamp might be 10 digits and another might be 13 digits.
- 10 digits usually means seconds.
- 13 digits usually means milliseconds.
- If a converted date looks far in the future, you may be using the wrong unit.
Local time and UTC
UTC is the shared reference time. Your local time is UTC adjusted by your time zone. When debugging time bugs, compare both values so you can tell whether the problem is the timestamp itself or the display time zone.