Unix Timestamps Explained: Epoch Time, Seconds and Milliseconds
Updated October 22, 2026
A Unix timestamp is one number for a moment in time: the seconds that have passed since 1 January 1970 (UTC). Programs love it because it is simple, sortable and the same everywhere.
How it works
The count starts at the "epoch", 00:00:00 UTC on 1 January 1970. A timestamp of 0 is that moment, 86400 is exactly one day later, and 1700000000 is 14 November 2023 at 22:13:20 UTC.
Seconds, milliseconds and more
| Unit | Digits today | Example | Common in |
|---|---|---|---|
| Seconds | 10 | 1700000000 | Unix, PHP, Python, many APIs |
| Milliseconds | 13 | 1700000000000 | JavaScript, Java |
| Microseconds | 16 | 1700000000000000 | Databases and logs |
| Nanoseconds | 19 | 1700000000000000000 | Go and fast timers |
Converting in code
| Language | Timestamp to date |
|---|---|
| JavaScript | new Date(1700000000 * 1000).toISOString() |
| Python | datetime.fromtimestamp(1700000000, tz=timezone.utc) |
| PHP | date('c', 1700000000) |
| MySQL | SELECT FROM_UNIXTIME(1700000000); |
| PostgreSQL | SELECT to_timestamp(1700000000); |
Common mistakes
- Mixing seconds and milliseconds: a date in 1970 usually means you passed seconds where milliseconds were expected, and a date thousands of years away means the opposite.
- Forgetting the time zone: a timestamp has none, but the date you display does. Store timestamps or UTC, and convert to local time only when showing it.
- Using local midnight as a "date" and then comparing across time zones.
The year 2038 problem
A signed 32-bit number can hold at most 2,147,483,647, which is 19 January 2038 at 03:14:07 UTC. Systems that store a timestamp in 32 bits will overflow one second later. Most modern software uses 64 bits, which lasts for hundreds of billions of years, but old embedded systems and file formats may still be affected.
Frequently asked questions
What is a Unix timestamp for right now?
Open the Unix Timestamp Converter: it shows the current time in seconds and milliseconds and updates every second.
Does a Unix timestamp include leap seconds?
No. Unix time ignores leap seconds, so every day is exactly 86,400 seconds long.