JS Built-ins
← Date67 / 120
DategetUTCFullYearbeginner

getUTCFullYear() β€” epoch year is 1970

πŸ“– Usage Example
const d = new Date('2024-01-15T00:00:00.000Z')
d.getUTCFullYear()  // β†’ 2024

Use getUTCFullYear() to retrieve the four-digit UTC year of a Date, regardless of local timezone.

Date.prototype.getUTCFullYear()

The Unix epoch is Jan 1, 1970 UTC, so getUTCFullYear() returns 1970.

Challenge: Verify that new Date(0).getUTCFullYear() returns 1970.

πŸ’‘ Hints (1)
  • β€’ The UTC year of the epoch is reliably 1970 in every timezone