Javascript examples for Date:getUTCMonth
Return the name of the month, according to universal time
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from ww w . java 2s . c o m*/ var d = new Date(); var month = new Array(12); 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 n = month[d.getUTCMonth()]; document.getElementById("demo").innerHTML = n; } </script> <p><strong>Note:</strong> 0=January, 1=February, Etc.</p> </body> </html>