Home >>JavaScript Date Object Methods >JavaScript getDate() Method

JavaScript getDate() Method

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()

Browser Support

Method Chrome Edge Firefox Safari Opera
getDate() Yes Yes Yes Yes Yes
Here is an example of JavaScript getDate() method:
<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>
Output:

Click the button to see the Output.