Example 1 — Build a UTC Date from Parts
Pass UTC parts to Date.UTC(), then wrap the milliseconds in new Date.
const utcDate = new Date(Date.UTC(96, 1, 2, 3, 4, 5));
console.log(utcDate.toUTCString());
// "Fri, 02 Feb 1996 03:04:05 GMT" How It Works
- Call
Date.UTC. Year96becomes1996; month1is February. - Get a number. The static method returns epoch milliseconds for that UTC time.
- Wrap with
new Date. The constructor turns those ms into aDateobject. - Print in UTC.
toUTCString()shows the GMT string without local-zone noise.

