<!DOCTYPE html>
<html>
<body>
<p>Click the button to display a date after changing the year, month, and day.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var d = new Date();
d.setFullYear(2020, 10, 3);
document.getElementById("demo").innerHTML = d;
}
</script>
<p><strong>Note:</strong> Remember that JavaScript counts months from 0 to 11. Month 10 is November.</p>
</body>
</html>