Home / Developer tools / Milliseconds to date

Milliseconds to Date Converter

Convert a 13-digit millisecond timestamp, as given by JavaScript Date.now() or Java System.currentTimeMillis(), to a readable date. The unit is set to milliseconds, and you can paste many values at once.

Timestamp to date

Try:

Everything runs in your browser. Your data is not sent to our server.

What a millisecond timestamp is

A millisecond timestamp is the number of milliseconds since 00:00:00 UTC on 1 January 1970. It is the Unix timestamp multiplied by 1000, so it has 13 digits for any date between September 2001 and November 2286. JavaScript, Java, many databases and message systems use it because it keeps the time of an event to a thousandth of a second.

1700000000000 ms
= 1700000000 seconds
= 2023-11-14T22:13:20.000Z

To convert by hand, divide by 1000 to get seconds, then convert the seconds. The part after the division, the remainder, is the milliseconds: 1700000000123 is the same second plus 123 ms, shown as 22:13:20.123.

Where milliseconds come from

  • JavaScript: Date.now(), new Date().getTime() and performance.timeOrigin.
  • Java and Kotlin: System.currentTimeMillis(), Instant.toEpochMilli().
  • Elasticsearch dates with the epoch_millis format, Kafka record timestamps, MongoDB and many REST APIs.
  • Mobile apps and analytics: Android System.currentTimeMillis() and most event trackers.

Check the unit before you trust the date

You haveRead as milliseconds it givesRead as seconds it gives
1700000000000 (13 digits)14 Nov 2023, correctA date tens of thousands of years ahead
1700000000 (10 digits)20 Jan 1970, probably wrong14 Nov 2023, correct

A 10-digit result from this page that lands in January 1970 almost always means the number is in seconds. The page shows a warning in that case. Use the timestamp to date page, where the unit is detected automatically.

Microseconds and nanoseconds

Some systems record even finer time. Divide a 16-digit value (microseconds) by 1000, or a 19-digit value (nanoseconds) by 1,000,000, to get milliseconds. You can also choose those units in the Unit box. Dates are shown to the millisecond.

Convert milliseconds to a date in code

// JavaScript
new Date(1700000000000).toISOString();         // "2023-11-14T22:13:20.000Z"

// Java
Instant.ofEpochMilli(1700000000000L);

# Python (divide by 1000)
from datetime import datetime, timezone
datetime.fromtimestamp(1700000000000 / 1000, tz=timezone.utc)

// PHP
gmdate('Y-m-d H:i:s', intdiv(1700000000000, 1000));

// C#
DateTimeOffset.FromUnixTimeMilliseconds(1700000000000);

// Go
time.UnixMilli(1700000000000).UTC()

-- MySQL
SELECT FROM_UNIXTIME(1700000000000 / 1000);

-- PostgreSQL
SELECT to_timestamp(1700000000000 / 1000.0);

JavaScript limits

A JavaScript Date holds at most 8,640,000,000,000,000 ms either side of 1970, which is about 275,760 years. Beyond that, new Date(x) gives Invalid Date. This page reports an error for such values instead of a wrong date.

Date to milliseconds

For the other direction use date to timestamp, which shows the milliseconds next to the seconds. To get the current value, see the current Unix timestamp page. The full background is in What is Unix time?

Frequently asked questions

How do I convert milliseconds to a date?

Paste the 13-digit number. It is read as milliseconds since 1970 and shown as a date in your time zone and in UTC.

How many digits does a millisecond timestamp have?

13 digits for dates from September 2001 until November 2286. Seconds timestamps have 10 digits.

How do I get milliseconds in JavaScript?

Date.now() returns the current time in milliseconds since 1970.

Why does my result show January 1970?

The number is in seconds, not milliseconds. Use the timestamp to date converter, which detects the unit.

Can I convert microseconds or nanoseconds here?

Yes. Choose the unit in the Unit box. The date is shown to the millisecond.