constructor

Date.UTC

Returns the milliseconds since the Unix epoch for the given components interpreted as UTC. Unlike the Date component constructor, it does not apply the local timezone.

Date.UTC(year, month, day, hours, minutes, seconds, ms)

Parameters

Parameter Purpose
year full year (values 0-99 are treated as 1900+year)
month 0-indexed month (Jan=0, Dec=11)
day day of month 1-31 (default 1)
hours, minutes, seconds, ms optional time components (default 0)

Examples

console.log(Date.UTC(2026, 6, 19)); // 1784332800000

July 19 2026 UTC midnight

console.log(new Date(Date.UTC(2026, 0, 1)).toISOString()); // '2026-01-01T00:00:00.000Z'

build a UTC Date

console.log(Date.UTC(2026, 11, 31, 23, 59, 59)); // last second of 2026 UTC

month 11 = December

Gotcha

Month is 0-indexed just like the Date constructor; forgetting this shifts everything by one month.

Related

← All JS Date methods · Math methods · Cron syntax