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.

Example

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

Live Demo

<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
raja
Published on 13-Feb-2018 08:17:01
Advertisements