Unix Timestamp Converter

Turn a Unix timestamp into a date, or a date into a timestamp, in any unit and time zone.

Timestamp tool

Unix timestamp converter

NOWCurrent Unix time— seconds— ms

Timestamp to date

Unit

Date to timestamp

How to use this converter

  1. 1

    Paste a timestamp. Leave the unit on Auto, or choose seconds, milliseconds, microseconds or nanoseconds yourself.

  2. 2

    Read the dates. UTC and your local time are shown, plus any extra time zone you add. Every row has a Copy button.

  3. 3

    Go the other way. Enter a date, a time and its time zone to get the timestamp in all four units.

Example

1700000000 seconds is 2023-11-14T22:13:20Z: 22:13:20 UTC, which is 17:13:20 in New York.

−1 second is 1969-12-31T23:59:59Z, one second before the epoch, and 9223372036854775807 nanoseconds (the largest signed 64-bit value) is 2262-04-11T23:47:16.854775807Z.

About Unix time

The Unix epoch

A Unix timestamp counts the time elapsed since the Unix epoch, 1970-01-01T00:00:00Z. Unix time treats every day as exactly 86,400 seconds, so leap seconds are not counted. A timestamp identifies an instant and has no time zone; the zone only matters when it is turned into a wall-clock date.

Common formats

UnitDigits todayExample (2023-11-14T22:13:20Z)
Seconds101700000000
Milliseconds131700000000000
Microseconds161700000000000000
Nanoseconds191700000000000000000

How this converter works

Values are held as exact integers (BigInt), so a 19-digit nanosecond timestamp is never rounded through a floating-point number. Decimals are accepted up to the unit’s limit, such as 1700000000.123456789 seconds. Negative timestamps are dates before 1970: −1 millisecond is 23:59:59.999 on December 31, 1969. The supported range is the years 1 to 9999.

Auto-detect and ambiguity

Auto picks the unit from the size of the number: below 1011 it is seconds, below 1014 milliseconds, below 1017 microseconds, otherwise nanoseconds. A value in the last decade below a boundary, such as 50000000000, is a plausible date in two units (the year 3554 as seconds, 1971 as milliseconds). The tool then says so and shows the other reading; choose the unit yourself to settle it.

Precision of the timestamp and of the date

The date is shown with as many fractional digits as the timestamp has: three for milliseconds, six for microseconds, nine for nanoseconds. That is the precision of the number, not a claim about the clock that produced it.

The Year 2038 problem

Systems that store Unix time in a signed 32-bit integer run out of range after 2,147,483,647 seconds, which is 2038-01-19T03:14:07Z. One second later the value wraps to −2,147,483,648, which reads as 1901-12-13T20:45:52Z. Modern systems use 64-bit time, which lasts for hundreds of billions of years, but 32-bit fields still exist in older software, embedded devices and some file and database formats.

Code examples

Each snippet was run and printed the commented result.

JavaScript

new Date(1700000000 * 1000).toISOString()
// "2023-11-14T22:13:20.000Z"
Math.floor(Date.parse("2023-11-14T22:13:20Z") / 1000)
// 1700000000
Math.floor(Date.now() / 1000)  // now

Python

from datetime import datetime, timezone
datetime.fromtimestamp(1700000000, tz=timezone.utc).isoformat()
# '2023-11-14T22:13:20+00:00'
int(datetime(2023, 11, 14, 22, 13, 20,
             tzinfo=timezone.utc).timestamp())
# 1700000000

Go

t := time.Unix(1700000000, 0).UTC()
t.Format(time.RFC3339) // 2023-11-14T22:13:20Z
t.Unix()               // 1700000000
time.Now().Unix()      // now

PHP

echo gmdate("c", 1700000000);
// 2023-11-14T22:13:20+00:00
echo strtotime("2023-11-14T22:13:20Z");
// 1700000000
echo time();  // now

SQL (SQLite)

SELECT datetime(1700000000, 'unixepoch');
-- 2023-11-14 22:13:20
SELECT CAST(strftime('%s', '2023-11-14 22:13:20') AS INTEGER);
-- 1700000000

SQL (MySQL)

SET time_zone = '+00:00';
SELECT FROM_UNIXTIME(1700000000);
-- 2023-11-14 22:13:20
SELECT UNIX_TIMESTAMP('2023-11-14 22:13:20');
-- 1700000000

Questions

Why is my timestamp read as milliseconds?

JavaScript, Java and many APIs use milliseconds, which are 13 digits for current dates. With Auto, a 13-digit number is read as milliseconds; choose Seconds if that is what you have.

Does a Unix timestamp depend on the time zone?

No. It counts time from one fixed instant in UTC. Only the displayed date and clock time change with the zone.