Javascript examples for Date:getDate
The getDate() method returns the day of the month (from 1 to 31) for the specified date.
None
A Number, from 1 to 31, representing the day of the month
The following code shows how to return the day of the month:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* www. j ava 2s. co m*/ var d = new Date("July 21, 2020 01:15:00"); var n = d.getDate() document.getElementById("demo").innerHTML = n; } </script> </body> </html>