How to use the unix timestamp converter
- To read a timestamp, paste it into the first box. Its date and time appear underneath.
- To make a timestamp, pick a date and time in the second box.
- Click Copy next to the format you need.
What is a Unix timestamp?
A Unix timestamp, also called epoch time or POSIX time, is the number of seconds that have passed since midnight UTC on 1 January 1970. It is a single number with no time zone, which makes it easy for computers to store, compare and sort. For example, 1700000000 is 14 November 2023 at 22:13:20 UTC.
Seconds or milliseconds?
| Digits today | Unit | Used by |
|---|---|---|
| 10 | Seconds | Unix, Linux, PHP, Python, most databases and APIs |
| 13 | Milliseconds | JavaScript, Java, many web APIs |
| 16 | Microseconds | Some databases and logging systems |
| 19 | Nanoseconds | Go, high-precision logs |
The converter works out the unit from the number of digits. If it guesses wrong for a very old or far-future date, choose the unit yourself.
Get the current timestamp in code
| Language | Code |
|---|---|
| JavaScript | Math.floor(Date.now() / 1000) |
| Python | import time; int(time.time()) |
| PHP | time() |
| Linux or macOS shell | date +%s |
| SQL (MySQL) | SELECT UNIX_TIMESTAMP(); |
The year 2038 problem
Older systems store the timestamp in a signed 32-bit number, which runs out at 03:14:07 UTC on 19 January 2038. After that it wraps round to 1901. Modern systems use 64 bits, which lasts for billions of years.
To find the gap between two dates, use the date calculator.
Frequently asked questions
How do I convert a Unix timestamp to a date?
Paste the timestamp into the first box. The date is shown in your local time, in UTC and in ISO 8601 format.
How do I convert a date to a Unix timestamp?
Pick the date and time in the second box. The timestamp appears in the first box and in the list.
What time zone is a Unix timestamp in?
None. It counts seconds since 1970 in UTC, and is shown in your local time zone only for reading.
Why is my date in 1970?
The timestamp is probably being read in the wrong unit. Choose seconds or milliseconds by hand.