Unix Timestamp Converter (Epoch & Linux Time)
Convert Unix epoch timestamps (seconds or milliseconds) to human-readable dates in any time zone, and dates back to timestamps.
Convert Unix epoch timestamps (seconds or milliseconds) to human-readable dates in any time zone, and dates back to timestamps.
A Unix timestamp is the number of seconds since 1 January 1970 at 00:00:00 UTC, not counting leap seconds. Linux, PHP, Python and most databases use seconds, which is a 10-digit number today. JavaScript uses milliseconds, a 13-digit number. Divide milliseconds by 1000 to get seconds.
Unix time, also called epoch time, POSIX time or Linux time, counts the seconds that have passed since the Unix epoch: 1 January 1970, 00:00:00 UTC. It ignores leap seconds, so every day is exactly 86,400 seconds. Because it is a single number with no time zone attached, it is the easiest way for computers to store and compare moments in time.
Paste any value into the converter above and you see it as ISO 8601, RFC 2822, a relative time like 3 days ago, and the local time in zones such as UTC, New York, London, Dhaka, Kolkata, Dubai and Tokyo. The tool also accepts date text and turns it into a timestamp.
Classic Unix time is in seconds. Many modern systems use milliseconds instead, and some use microseconds. Count the digits to tell them apart:
| Digits (today) | Unit | Example | Used by |
|---|---|---|---|
| 10 | Seconds | 1700000000 | Linux, PHP, Python, MySQL, most APIs |
| 13 | Milliseconds | 1700000000000 | JavaScript, Java, many JSON APIs |
| 16 | Microseconds | 1700000000000000 | PostgreSQL internals, some logs |
All three examples mean 14 November 2023, 22:13:20 UTC. The converter detects the unit automatically. If you mix them up, a seconds value read as milliseconds lands in January 1970, and a milliseconds value read as seconds lands tens of thousands of years in the future. More detail in Unix time: seconds vs milliseconds.
These snippets get the current timestamp and convert in both directions. Always be explicit about UTC, because a date without a time zone is read in the local zone of the machine.
Math.floor(Date.now() / 1000); // now, in seconds
Date.now(); // now, in milliseconds
new Date(1700000000 * 1000).toISOString(); // 2023-11-14T22:13:20.000Z
Date.parse('2024-01-01T00:00:00Z') / 1000; // 1704067200import time
from datetime import datetime, timezone
int(time.time()) # now, seconds
datetime.fromtimestamp(1700000000, tz=timezone.utc) # to date
int(datetime(2024, 1, 1, tzinfo=timezone.utc).timestamp()) # 1704067200time(); // now, seconds
gmdate('Y-m-d H:i:s', 1700000000); // 2023-11-14 22:13:20
strtotime('2024-01-01 00:00:00 UTC'); // 1704067200SELECT UNIX_TIMESTAMP(); -- now, seconds
SELECT FROM_UNIXTIME(1700000000); -- uses the session time zone
SELECT UNIX_TIMESTAMP('2024-01-01 00:00:00'); -- read in the session time zonedate +%s # now, seconds
date +%s%3N # now, milliseconds (GNU date)
date -u -d @1700000000 # timestamp to date (GNU/Linux)
date -u -d '2024-01-01 00:00:00' +%s # date to timestamp: 1704067200
date -u -r 1700000000 # timestamp to date on macOS/BSD=A1/86400 + DATE(1970,1,1) timestamp in A1 to date (format the cell as date/time)
=A1/86400000 + DATE(1970,1,1) milliseconds to date
=(A1 - DATE(1970,1,1)) * 86400 date in A1 to timestampThe spreadsheet results are in UTC. Add or subtract hours divided by 24 to shift to your time zone, for example +6/24 for Bangladesh time.
A timestamp is the same number everywhere on Earth. Only the readable date changes with the time zone. In the Date to timestamp box, the date you pick is read in your browser's local time zone, so if you need the timestamp for a UTC time, set your computer to UTC or adjust by your offset. The current Unix time, in seconds and milliseconds, is shown live at the top of the tool.
Older systems store Unix time as a signed 32-bit integer. Its largest value, 2147483647, is reached at 03:14:07 UTC on 19 January 2038. One second later the number overflows and wraps to a negative value, which those systems read as 13 December 1901. Modern 64-bit operating systems, databases and languages use 64-bit time values that last for billions of years, but old embedded devices, file formats and database columns such as MySQL TIMESTAMP can still be affected. JavaScript is safe: its millisecond dates work up to the year 275760.
Working with API responses full of timestamps? Format them with the JSON formatter, or read the expiry claim of a token with the JWT inspector.
Standard Unix time is in seconds. JavaScript, Java and many APIs use milliseconds instead, so a 13-digit value is milliseconds and a 10-digit value is seconds.
Enter the date and time in the Date to timestamp box above and copy the seconds or milliseconds value. In code, parse the date as UTC and call the timestamp function of your language, as shown in the examples on this page.
Divide by 1000 and drop the decimals. For example, 1700000000000 milliseconds becomes 1700000000 seconds.
Linux time is the same as Unix time: seconds since 1970-01-01 00:00:00 UTC. You can print it with the command date +%s.
No. A timestamp marks one instant, the same everywhere. Time zones only matter when you turn it into a readable date.
Timestamp 0 is Thursday, 1 January 1970, 00:00:00 UTC, also called the Unix epoch. Negative timestamps are dates before 1970.
The number of seconds since 1 January 1970 00:00:00 UTC.
The converter detects both automatically: 10 digits are seconds, 13 digits are milliseconds.