Set the date to November 3, 2020: - Javascript Date

Javascript examples for Date:setFullYear

Description

Set the date to November 3, 2020:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

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

<script>
function myFunction() {// w w  w  . j  av a2s . c  om
    var d = new Date();
    d.setFullYear(2020, 10, 3);
    document.getElementById("demo").innerHTML = d;
}
</script>

</body>
</html>

Related Tutorials