JS Built-ins
← Date74 / 120
DategetUTCMonthbeginner

getUTCMonth() β€” result is a number

πŸ“– Usage Example
const d = new Date('2024-06-15T00:00:00.000Z')
d.getUTCMonth()  // β†’ 5 (June)
// 0=Jan, 11=Dec

Use getUTCMonth() to retrieve the zero-indexed UTC month (0 = January through 11 = December) of a Date.

Date.prototype.getUTCMonth()

getUTCMonth() returns a number in [0, 11].

Challenge: Verify that typeof new Date('2024-06-15T12:30:45.000Z').getUTCMonth() returns 'number'.

πŸ’‘ Hints (1)
  • β€’ getUTCMonth() always returns an integer number