How to use the unix timestamp converter
- To decode: paste a timestamp in the Unix timestamp box. Seconds and milliseconds are detected automatically.
- To encode: choose a date and time, and read the timestamp.
- Press Copy next to the format you need.
- Press Use current time to fill in this moment.
What is Unix time?
Unix time, also called epoch time or POSIX time, is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970. Because it is a single number with no time zone, it is the usual way for computers to store and compare moments in time. The same instant has the same timestamp everywhere in the world.
Seconds or milliseconds?
| Digits | Unit | Used by |
|---|---|---|
| 10 | Seconds | Unix and Linux, PHP, Python, most databases and APIs |
| 13 | Milliseconds | JavaScript, Java, many logging systems |
| 16 | Microseconds | Some databases and analytics exports |
| 19 | Nanoseconds | Go, high-precision logs |
Reference values
| Timestamp | Date (UTC) |
|---|---|
| 0 | 1 January 1970, 00:00:00 |
| 1000000000 | 9 September 2001, 01:46:40 |
| 1500000000 | 14 July 2017, 02:40:00 |
| 1700000000 | 14 November 2023, 22:13:20 |
| 2000000000 | 18 May 2033, 03:33:20 |
| 2147483647 | 19 January 2038, 03:14:07 |
The year 2038 problem
Older systems store the timestamp as a signed 32-bit number, which can count no higher than 2,147,483,647. One second after 03:14:07 UTC on 19 January 2038, such a counter wraps around to a negative number and the date appears to jump back to 1901. Modern systems use 64-bit numbers, which will last for about 292 billion years.
Get the current timestamp in code
| Language | Code |
|---|---|
| JavaScript | Math.floor(Date.now() / 1000) |
| Python | import time; int(time.time()) |
| PHP | time() |
| Java | System.currentTimeMillis() / 1000 |
| Go | time.Now().Unix() |
| Ruby | Time.now.to_i |
| SQL (MySQL) | SELECT UNIX_TIMESTAMP(); |
| SQL (PostgreSQL) | SELECT EXTRACT(EPOCH FROM NOW()); |
| Bash | date +%s |
Useful intervals in seconds
A minute is 60, an hour 3,600, a day 86,400, a week 604,800 and a 365-day year 31,536,000.