Unix Timestamps Explained: Epoch Time, Seconds vs Milliseconds and Time Zones
What epoch time is, why it's the standard way to store dates, how to tell seconds from milliseconds, and how to avoid the time-zone bugs it causes.
Editorial disclosure: Pyalm publishes and maintains the products and free tools discussed on this site. Regulatory statements are linked to primary sources where applicable. No independent professional review is claimed unless a reviewer is explicitly named.
A Unix timestamp is the number of seconds since 00:00:00 UTC on 1 January 1970 — "the epoch". 1760572800 is a moment in October 2025. Databases, logs, JWTs, payment APIs and webhooks all use it because a single number has no time zone, no formatting and no ambiguity.
Convert a timestamp in seconds
Paste it into the free Epoch Converter. It shows the date in UTC, your local time and any time zone, plus ISO 8601 and how long ago (or how far ahead) it is. It also converts the other way, from a date to a timestamp.
Seconds, milliseconds, microseconds
| Digits (today) | Unit | Typical source |
|---|---|---|
| 10 | Seconds | Unix, PHP time(), Python int(time.time()), JWT exp |
| 13 | Milliseconds | JavaScript Date.now(), Java, many APIs |
| 16 | Microseconds | PostgreSQL internals, some logging systems |
| 19 | Nanoseconds | Go, high-resolution tracing |
Treat milliseconds as seconds and you get a date tens of thousands of years in the future; the reverse lands in January 1970. If a dashboard shows 1970, a unit mix-up is the usual suspect.
Time zones: store UTC, display local
A timestamp is always UTC. Time zones only enter when you display it. The safe pattern:
- Store timestamps (or ISO 8601 with
Z) in UTC. - Convert to the user's time zone only in the interface.
- Never store a "local time" without its zone.
Bugs appear when one system writes local time and another reads it as UTC — the classic "everything is 4 hours off" in Dubai (UTC+4) or "5½ hours off" in India (UTC+5:30).
Handy snippets
JavaScript Math.floor(Date.now() / 1000)
Python import time; int(time.time())
PHP time();
PostgreSQL SELECT extract(epoch FROM now());
MySQL SELECT UNIX_TIMESTAMP();
Bash date +%s
The year 2038 problem
Systems that store Unix time in a signed 32-bit integer overflow at 03:14:07 UTC on 19 January 2038 and wrap to 1901. Modern languages and databases use 64-bit values, but old embedded devices and legacy database columns (INT instead of BIGINT) are still at risk. Check any long-lived data such as loan end dates, warranties and licences.
Leap seconds
Unix time ignores leap seconds — every day is exactly 86,400 seconds. For business software this never matters; for scientific timing, use specialised time scales.
Where timestamps meet business logic
Invoice due dates, subscription renewals, SLA timers and scheduled reports all depend on getting time right across zones. Pyalm builds business automation and custom software where scheduling and time zones are handled properly — including UAE weekends and multi-country teams.
Related free tools
Epoch Converter | Time Zone Converter | Cron Expression Generator | JWT Decoder | All free tools