JS Built-ins
← Date80 / 120
DategetUTCDatebeginner

getUTCDate() β€” epoch day is 1

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

Use getUTCDate() to retrieve the day of the month (1–31) in UTC, unaffected by the local timezone.

Date.prototype.getUTCDate()

The Unix epoch is January 1, 1970 UTC, so getUTCDate() returns 1.

Challenge: Verify that new Date(0).getUTCDate() returns 1.

πŸ’‘ Hints (1)
  • β€’ The epoch is Jan 1, 1970 UTC β€” day 1 of month 0 of year 1970