Example 1 — Read the UTC Full Year
Build a UTC instant with Date.UTC, then call getUTCFullYear().
const d = new Date(Date.UTC(1969, 6, 20)); // Jul 20, 1969 UTC
console.log(d.getUTCFullYear()); // 1969 How It Works
- Build a UTC date.
Date.UTC(1969, 6, 20)is July 20, 1969 in UTC (month index6). - Wrap it in
Date.new Date(...)stores that instant. - Read the UTC year.
getUTCFullYear()returns1969. - No side effects. The
Dateis unchanged;getUTCFullYearonly reads.

