JS Built-ins
← Date31 / 120
DategetDatebeginner

getDate() β€” day 15

πŸ“– Usage Example
const d = new Date(2024, 0, 15)
d.getDate()  // β†’ 15

Use getDate() to retrieve the day of the month (1–31) in local time from a Date object.

Date.prototype.getDate()

Returns the day of the month (1–31) in local time.

Challenge: Verify that new Date(2024, 0, 15).getDate() returns 15.

πŸ’‘ Hints (1)
  • β€’ getDate() returns the day of the month β€” NOT the day of the week (that is getDay())