What Is Unix Time?
Unix time counts the seconds since the Unix epoch: 00:00:00 UTC on 1 January 1970. Because it is one number that does not depend on a time zone, it is the standard way for programs, databases, logs and APIs to record when something happened. To show it to a person, the number is converted into a calendar date and a time zone, which is what this page does.
Seconds, Milliseconds and Microseconds
The same moment can be written at different precisions. The number of digits is the quickest clue:
| Unit | Digits today | Example | Common in |
|---|---|---|---|
| Seconds | 10 | 1700000000 | Unix, Python, PHP, MySQL, JWT |
| Milliseconds | 13 | 1700000000000 | JavaScript, Java, Kotlin |
| Microseconds | 16 | 1700000000000000 | Some databases and logs |
| Nanoseconds | 19 | 1700000000000000000 | Go, high-resolution logs |
A frequent bug is passing milliseconds to a function that expects seconds, which gives a date tens of thousands of years in the future. If a date looks wildly wrong, check the unit first.
Well-Known Timestamps
| Timestamp | Date and time (UTC) |
|---|---|
| 0 | 1 January 1970, 00:00:00 (the epoch) |
| 1000000000 | 9 September 2001, 01:46:40 |
| 1700000000 | 14 November 2023, 22:13:20 |
| 2000000000 | 18 May 2033, 03:33:20 |
| 2147483647 | 19 January 2038, 03:14:07 (largest signed 32-bit value) |
Useful lengths to remember: 3,600 seconds is one hour, 86,400 is one day and 604,800 is one week. To count whole working days between two dates instead, use the Business Days Calculator.
The Year 2038 Problem
Systems that keep the timestamp in a signed 32-bit integer can only count up to 2147483647, which is 03:14:07 UTC on 19 January 2038. After that the value wraps around to a negative number, which reads as a date in 1901. Current operating systems, languages and databases use 64-bit values, but old embedded devices and file formats can still be affected.
Unix Timestamps in Other Tools
Time-ordered identifiers carry the same kind of number. A UUID v7 starts with a 48-bit timestamp in milliseconds, and the checker in the UUID Generator shows the date stored inside one.
Convert a Timestamp in Your Own Code
// JavaScript (milliseconds) Date.now() // current time in ms Math.floor(Date.now() / 1000) // current time in seconds new Date(1700000000 * 1000).toISOString() // 2023-11-14T22:13:20.000Z # Python import time, datetime int(time.time()) datetime.datetime.fromtimestamp(1700000000, tz=datetime.timezone.utc) -- MySQL SELECT UNIX_TIMESTAMP(); SELECT FROM_UNIXTIME(1700000000); -- PostgreSQL SELECT EXTRACT(EPOCH FROM now()); SELECT to_timestamp(1700000000); # Linux (GNU date) and macOS date -u -d @1700000000 date -u -r 1700000000 # Excel or Google Sheets (seconds in A1) =A1/86400+DATE(1970,1,1)
The Excel formula gives a UTC date and time. Format the cell as a date and time to see it.