Home >>JavaScript Date Object Methods >JavaScript getDate() Method
JavaScript getDate() method is used to return the day of the month for the given input date. It returns the day as a integer value between 1 to 31.
Syntax:Date.getDate()
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
getDate() | Yes | Yes | Yes | Yes | Yes |
<html> <body> <p>Click the button to see the Output.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var d = new Date(); var n = d.getDate(); document.getElementById("demo").innerHTML = n; } </script> </body> </html>
Click the button to see the Output.