Javascript examples for Date:setMonth
Set the month to 4 (May) and the day to the 20th:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w ww.j av a 2s . c o m var d = new Date(); d.setMonth(4, 20); document.getElementById("demo").innerHTML = d; } </script> </body> </html>