Javascript examples for Date:getMonth
Return the name of the month
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* w w w . jav a2s . c o m*/ var month = new Array(); month[0] = "January"; month[1] = "February"; month[2] = "March"; month[3] = "April"; month[4] = "May"; month[5] = "June"; month[6] = "July"; month[7] = "August"; month[8] = "September"; month[9] = "October"; month[10] = "November"; month[11] = "December"; var d = new Date(); var n = month[d.getMonth()]; document.getElementById("demo").innerHTML = n; } </script> </body> </html>