How to use getDate in JavaScript
In this article, I will explain use of getDate() Method in JavaScript Date Object.
JavaScript Date Object
JavaScript getDate() method
- getDate() method returns the day of the month between 1 to 31 for the specified date according to local time.
- In getDate() method, the retune value is integer value.
Syntax
Example
In the following example show to getDate() method returns current date.
<!DOCTYPE html>
<html>
<body>
<h3 style="color:Blue">JavaScript getDate() Method Example</h3>
<p id="demo">Click the button to display todays day of the month.</p>
<button onclick="myFunction()">Click ON</button>
<script type="text/javascript">
function myFunction() {
var d = new Date();
var x = document.getElementById("demo");
document.write("Today Date is: " + d.getDate());
}
</script>
</body>
</html>
|
Output1

Output2

You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here