JavaScript Date.prototype.getDate() Method
The getDate() method returns the day of the month (1 to 31) of a date.
Description
The getDate() method returns the day of the month, from 1 to 31, in local time. Don't confuse it with getDay(), which returns the day of the week.
Day 0 of a month means the last day of the previous month, so new Date(year, month + 1, 0).getDate() gives the number of days in any month, including leap years for February.
Like the other get...() methods without "UTC" in their name, it uses the time zone of the user's device, so the same moment can give different results for users in different places. Each has a getUTC...() counterpart for UTC, and for showing a date in a particular time zone, toLocaleString() with the timeZone option is the easiest approach.
Syntax
date.getDate()Return Value
The day of the month in local time, from 1 to 31.
Example
Browser Support
The following information will show you the current browser support for the Date.prototype.getDate() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





