What a Unix timestamp is
A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970, not counting leap seconds. It is one plain number, it has no time zone, and it is the same everywhere in the world at the same moment. That is why databases, APIs, log files, JWT tokens and programming languages use it to store a point in time.
| Unix timestamp | Date and time (UTC) |
|---|---|
0 | 1970-01-01 00:00:00 |
1000000000 | 2001-09-09 01:46:40 |
1700000000 | 2023-11-14 22:13:20 |
1800000000 | 2027-01-15 08:00:00 |
2147483647 | 2038-01-19 03:14:07 (the 32-bit limit) |
How this converter works
The top panel shows the current Unix time and keeps ticking. Below it, Timestamp to date turns a number into a date in the time zone you choose, and Date to timestamp does the reverse. Both run in your browser, so nothing you type is uploaded.
With the unit set to Auto, the size of the number decides the unit:
| Value (absolute) | Read as | Typical digits | Common source |
|---|---|---|---|
| below 100 billion | Seconds | 10 | Unix time(), PHP, Python, JWT, Stripe |
| 100 billion to 100 trillion | Milliseconds | 13 | JavaScript Date.now(), Java, Kafka |
| 100 trillion to 100 quadrillion | Microseconds | 16 | Cassandra writetime, Python datetime in µs |
| above that | Nanoseconds | 19 | Go UnixNano(), InfluxDB, tracing systems |
A millisecond value from the first three years after 1970 is shorter than 11 digits and would be read as seconds. If you know your data is in milliseconds, set the unit yourself. See the page for milliseconds to date for details.
Useful durations in seconds
| Period | Seconds |
|---|---|
| 1 minute | 60 |
| 1 hour | 3600 |
| 1 day | 86400 |
| 1 week | 604800 |
| 30 days | 2592000 |
| 365 days | 31536000 |
Adding 86400 to a timestamp moves it forward by 24 hours, which is not always "the same time tomorrow" in a time zone that changes its clocks.
Get the current Unix timestamp in code
// JavaScript Math.floor(Date.now() / 1000) # Python import time; int(time.time()) // PHP time(); // Java Instant.now().getEpochSecond(); // C# DateTimeOffset.UtcNow.ToUnixTimeSeconds(); // Go time.Now().Unix() # Ruby Time.now.to_i # Shell (Linux, macOS) date +%s
More languages, with the reverse conversions, are on the current Unix timestamp and timestamp to date pages.
Common mistakes
- Mixing seconds and milliseconds. A 13-digit value read as seconds lands tens of thousands of years in the future. A 10-digit value read as milliseconds lands in January 1970.
- Reading a timestamp as local time. The number is UTC based. Only the display depends on the time zone.
- Storing 32-bit integers. They stop at 2147483647, which is 19 January 2038. Use 64-bit fields. The Unix time guide explains the problem.
- Doing date maths on local times. Add or subtract in UTC, and convert to a time zone only when you show the result.
Next: epoch converter (other epochs such as Windows FILETIME), date to timestamp, and the guide What is Unix time?. Timestamps also appear in tokens: the JWT claims builder creates exp and iat values.