constructor

new Date()

Creates a Date object representing a single moment in time as milliseconds since the Unix epoch (1970-01-01T00:00:00Z). Called with no arguments it returns the current instant; with arguments it parses a timestamp, ISO string, or component parts.

new Date([value])

Parameters

Parameter Purpose
() current date/time from the system clock
(ms) milliseconds since Unix epoch (number)
(isoString) ISO 8601 string, e.g. '2026-07-19T12:00:00Z'
(y, m, d, h, mi, s, ms) component parts in LOCAL time; month is 0-11

Examples

console.log(new Date().toISOString());

current UTC instant

console.log(new Date(0).toISOString()); // '1970-01-01T00:00:00.000Z'

Unix epoch

console.log(new Date(2026, 6, 19).toDateString()); // 'Sun Jul 19 2026'

month 6 = July (0-indexed)

console.log(new Date('2026-07-19T00:00:00Z').getUTCDate()); // 19

ISO string parsed as UTC

Gotcha

The component-parts form uses 0-indexed months (Jan=0, Dec=11) and is interpreted in the LOCAL timezone; an ISO date-only string 'YYYY-MM-DD' is parsed as UTC while 'YYYY-MM-DDTHH:mm:ss' without a Z is local.

Related

← All JS Date methods · Math methods · Cron syntax