Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>Click the button to display the number that represent this month.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
    var d = new Date();
    var n = d.getMonth();
    document.getElementById("demo").innerHTML = n;
}
</script>

<p><strong>Note:</strong> 0=January, 1=February etc.</p>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy