To get the day of the month, use the getDate() method. JavaScript date getDate() method returns the day of the month for the specified date according to local time. The value returned by getDate() is an integer between 1 and 31.
Example
You can try to run the following code to learn how to get a day of the month in JavaScript −
<html> <head> <title>JavaScript getDate Method</title> </head> <body> <script> var dt = new Date("December 31, 2017 11:20:10"); document.write("Today is " + dt.getDate() ); </script> </body> </html>
Output
Today is 31