How to use it
- 1The current Unix time ticks at the top of the tool. Click Copy to take it in seconds or milliseconds.
- 2Paste a timestamp under “Timestamp to date”. The unit is recognised from the number of digits; if the guess is wrong, choose seconds, milliseconds, microseconds or nanoseconds yourself.
- 3You can also paste a date, such as
2024-05-01T12:00:00ZorWed, 01 May 2024 12:00:00 GMT, to see it in every format and as a timestamp. - 4To go the other way, pick a date and time under “Date to timestamp”, choose local time or UTC, and copy the result.
What is Unix time?
Unix time – also called epoch time or a POSIX timestamp – counts the seconds since 00:00:00 UTC on 1 January 1970, the Unix epoch. The count passed 1,700,000,000 on 14 November 2023 at 22:13:20 UTC. Moments before 1970 are negative numbers.
A timestamp is a single number, free of time zones, calendars and date formats, so it’s easy to store, sort and compare. That’s why databases, APIs, log files, file systems and JSON Web Tokens use it everywhere.
Seconds, milliseconds, microseconds or nanoseconds?
Classic Unix time counts seconds, and today’s values have 10 digits. JavaScript’s Date.now() and Java’s System.currentTimeMillis() return milliseconds (13 digits), some databases store microseconds (16 digits), and Go’s UnixNano() and Python’s time.time_ns() return nanoseconds (19 digits).
The converter guesses the unit from the length of the number: up to 11 digits it assumes seconds, 12–14 digits milliseconds, 15–17 microseconds and 18 or more nanoseconds. Only very small millisecond values, from before March 1973, are ambiguous – pick the unit yourself for those.
Time zones, the year 2038 and leap seconds
A timestamp marks the same instant everywhere on Earth; only its display depends on the time zone. 1,700,000,000 is 22:13:20 in London, 23:13:20 in Prague and 17:13:20 in New York. Store and exchange UTC, and convert to local time only when you show it to people.
Systems that keep Unix time in a signed 32-bit integer run out at 03:14:07 UTC on 19 January 2038, when the counter overflows and jumps back to 1901 – the year 2038 problem. Current systems use 64 bits, which last for billions of years.
Unix time ignores leap seconds: every day counts as exactly 86,400 seconds. When a leap second is added to UTC, the Unix clock repeats a second or spreads it out, so a difference between two timestamps can be short by the leap seconds in between – 27 of them since 1972.
Questions and answers
How do I get the current Unix timestamp?
It’s shown at the top of this page. In code, use Math.floor(Date.now() / 1000) in JavaScript, time.time() in Python, time() in PHP, DateTimeOffset.UtcNow.ToUnixTimeSeconds() in C#, or date +%s in a Linux or macOS terminal.
Is a Unix timestamp in seconds or milliseconds?
Traditionally in seconds, but many platforms, including JavaScript and Java, use milliseconds. Count the digits: a current timestamp has 10 digits in seconds and 13 in milliseconds. This converter recognises the unit and tells you which one it assumed.
Does Unix time depend on the time zone?
No. It’s always counted from midnight UTC on 1 January 1970, so it’s the same number everywhere at the same moment. The time zone only matters when you turn the number into a calendar date and a clock time.
What happens to Unix time in 2038?
At 03:14:07 UTC on 19 January 2038, Unix time passes 2,147,483,647 – the largest value a signed 32-bit integer can hold. Software that still stores time in 32 bits will wrap around to December 1901. Modern operating systems, databases and languages use 64-bit time and aren’t affected.
How do I convert a Unix timestamp in Excel or Google Sheets?
For seconds, use =A1/86400+DATE(1970,1,1) and format the cell as a date and time; for milliseconds, divide by 86,400,000 instead. The result is in UTC, so add or subtract your offset from UTC in hours divided by 24.