How to get the day of the month in JavaScript?

JavascriptWeb DevelopmentFront End Technology

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.


You can try to run the following code to learn how to get a day of the month in JavaScript −

Live Demo

      <title>JavaScript getDate Method</title>
         var dt = new Date("December 31, 2017 11:20:10");
         document.write("Today is " + dt.getDate() );


Today is 31
Published on 13-Feb-2018 08:17:01