This method does not take any parameters.
The getDate() method returns an integer between 1 and 31, representing the day of the month for the given date according to local time.
Example 1: How to Use the getDate() Method
let today = new Date(); let dayOfMonth = today.getDate(); console.log("Today's date is:", dayOfMonth);
Today's date is: 18
Example 2: Date getDate() returns NaN
let dateobj = new Date("September 32, 1993 05:35:32"); let data = dateobj.getDate(); console.log(data);
Example 3: Date getDate() returns 1
let date2 = new Date(2023, 7); console.log(date2.getDate());