getters

Date.prototype.getDate

Returns the day of the month (1-31) in LOCAL time. Do not confuse this with getDay, which returns the weekday.

date.getDate()

Parameters

Parameter Purpose
() no arguments; returns 1-31
local time use getUTCDate for the UTC day-of-month

Examples

console.log(new Date('2026-07-19T00:00:00Z').getUTCDate()); // 19

day of month

console.log(new Date(2026, 1, 0).getDate()); // 31 (last day of Jan)

day 0 rolls to previous month

console.log(new Date(2026, 2, 0).getDate()); // 28 (Feb 2026 has 28 days)

trick for days-in-month

Gotcha

getDate is 1-31 (day-of-month). It is NOT the same as getDay (0-6 weekday) - the names are famously confusing.

Related

← All JS Date methods · Math methods · Cron syntax