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