Javascript examples for Date:setFullYear
Set the date to November 3, 2020:
<!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>