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.

Loading Future Forge Tools…

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.

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.

How to use Timestamp Converter

  1. Paste a timestamp or date.
  2. See it in UTC, your time zone and other zones.
  3. Use the date picker to get a timestamp.

What is a Unix timestamp?

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.

Is Unix time in seconds or milliseconds?

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)UnitExampleUsed by
10Seconds1700000000Linux, PHP, Python, MySQL, most APIs
13Milliseconds1700000000000JavaScript, Java, many JSON APIs
16Microseconds1700000000000000PostgreSQL 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.

Convert time to Unix timestamp in code

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.

JavaScript

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;  // 1704067200

Python

import 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())  # 1704067200

PHP

time();                                        // now, seconds
gmdate('Y-m-d H:i:s', 1700000000);             // 2023-11-14 22:13:20
strtotime('2024-01-01 00:00:00 UTC');          // 1704067200

MySQL

SELECT 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 zone

Linux shell

date +%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

Excel and Google Sheets

=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 timestamp

The 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.

Time zones and the date to timestamp box

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.

The year 2038 problem

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.

Frequently asked questions

Is Unix time in seconds or milliseconds?

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.

How do I convert a time to a Unix timestamp?

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.

How do I convert a timestamp to Unix time if it is in milliseconds?

Divide by 1000 and drop the decimals. For example, 1700000000000 milliseconds becomes 1700000000 seconds.

What is Linux time?

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.

Does a Unix timestamp depend on the time zone?

No. A timestamp marks one instant, the same everywhere. Time zones only matter when you turn it into a readable date.

What date is Unix timestamp 0?

Timestamp 0 is Thursday, 1 January 1970, 00:00:00 UTC, also called the Unix epoch. Negative timestamps are dates before 1970.

What is a Unix timestamp?

The number of seconds since 1 January 1970 00:00:00 UTC.

Seconds or milliseconds?

The converter detects both automatically: 10 digits are seconds, 13 digits are milliseconds.