Convert a Unix Timestamp to a Date in JavaScript

Convert a Unix timestamp to a Date in JavaScript with new Date(ts * 1000). Check your result with the live converter and avoid the seconds vs milliseconds trap.

Part of the free Unix Timestamp Converter. Runs in your browser — nothing is uploaded.

Convert a Unix Timestamp to a Date in JavaScript

JavaScript's Date constructor expects milliseconds. A Unix timestamp in seconds must be multiplied by 1000 first. Use the converter to verify the date you expect before wiring it into code.

Worked example: new Date(1700000000 * 1000)

Code

new Date(1700000000 * 1000).toISOString()

Result of toISOString()

2023-11-14T22:13:20.000Z

Practical tip

For display, prefer toLocaleString with an explicit timeZone option such as { timeZone: "UTC" } so output is the same on every machine.

How to use this Unix Timestamp

  1. 1Use the live tool above — it runs entirely in your browser and never uploads your data.
  2. 2Paste the sample from the worked example, or use your own input.
  3. 3Copy the result, then adapt the same steps in your editor, script, or pipeline.

Convert a Unix Timestamp to a Date in JavaScript FAQs

Why does my timestamp show 1970 in JavaScript?

You passed seconds where milliseconds were expected. new Date(1700000000) is January 1970. Multiply by 1000.

How do I convert a Date back to a timestamp?

Use Math.floor(date.getTime() / 1000) for seconds, or date.getTime() for milliseconds.

More Unix Timestamp pages

Open the full Unix Timestamp tool →