Unix Timestamps Explained
What is a Unix Timestamp?
A Unix timestamp (also called Epoch time) is the number of seconds that have elapsed since January 1, 1970, at 00:00:00 UTC. It's a simple, timezone-agnostic way to represent a point in time as a single integer.
1704067200 → January 1, 2024 00:00:00 UTC 1000000000 → September 9, 2001 01:46:40 UTC 0 → January 1, 1970 00:00:00 UTC (the Epoch)
Seconds vs Milliseconds
Some APIs use seconds (10 digits), while JavaScript's Date.now() returns milliseconds (13 digits). Always check which format an API expects.
// JavaScript Date.now() // 1704067200000 (milliseconds) Math.floor(Date.now() / 1000) // 1704067200 (seconds) // Convert timestamp to date new Date(1704067200 * 1000) // Mon Jan 01 2024...
Common Mistakes
- Mixing seconds and milliseconds: Passing seconds to
new Date()gives a date in 1970. - Y2K38 problem: 32-bit signed integers overflow on January 19, 2038. Use 64-bit timestamps.
- Timezone confusion: Unix timestamps are always UTC. Convert to local time for display.
Convert timestamps with our Timestamp Converter or calculate date differences with the Date Difference Calculator.
FAQ
Why 1970?
Unix was being developed in the early 1970s. The date was chosen as a convenient, round starting point.
Can timestamps be negative?
Yes. Negative timestamps represent dates before January 1, 1970.