Set the date to November 3, 2020:setUTCFullYear(2020, 10, 3) - Javascript Date

Javascript examples for Date:setUTCFullYear

Description

Set the date to November 3, 2020:setUTCFullYear(2020, 10, 3)

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  ava 2s.c om
    var d = new Date();
    d.setUTCFullYear(2020, 10, 3);
    document.getElementById("demo").innerHTML = d;
}
</script>

</body>
</html>

Related Tutorials