JS Built-ins
← Date77 / 120
DategetUTCDatebeginner

getUTCDate() β€” day 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 first day of a month is 1 in UTC.

Challenge: Verify that new Date('2024-01-01T00:00:00.000Z').getUTCDate() returns 1.

πŸ’‘ Hints (1)
  • β€’ Days are 1-indexed for both getDate() and getUTCDate()