Set the day of the month, to a specified date: - Javascript Date

Javascript examples for Date:setDate

Description

Set the day of the month, to a specified date:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {//ww  w .j  a  v  a2 s .  co  m
    var d = new Date("July 21, 2020 01:15:00");
    d.setDate(15);
    document.getElementById("demo").innerHTML = d;
}
</script>

</body>
</html>

Related Tutorials