[JavaScript] Create a Date from a Unix timestamp

Created on November 30, 2026

Pass a Unix timestamp in milliseconds to the Date constructor. The example uses toISOString() to print the same UTC representation in every time zone.

const date = new Date(1637001495000);
console.log(date.toISOString());
2021-11-15T18:38:15.000Z

Multiply a timestamp in seconds by 1,000 first. Use toString() if you want a representation in the local time zone.

JavaScript