Set the month to 4 (May) and the day to the 20th:setUTCMonth(4, 20) - Javascript Date

Javascript examples for Date:setUTCMonth

Description

Set the month to 4 (May) and the day to the 20th:setUTCMonth(4, 20)

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

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

<script>
function myFunction() {/*from w ww  .  j  ava  2  s.  co  m*/
    var d = new Date();
    d.setUTCMonth(4, 20);
    document.getElementById("demo").innerHTML = d;
}
</script>

</body>
</html>

Related Tutorials