English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
getMonth() Returns the month of the specified date object according to local time (0-11()).
getMonth()The returned value is an integer corresponding to the month of the year: 0 represents January,1Represents February, and so on.
For the day of the week, seegetDay()Method.
For a specific day of the month, seegetDate()Method.
date.getMonth()
var d = new Date(); d.getMonth();Test and see‹/›
The getMonth() method is fully supported by all browsers:
Method | |||||
getMonth() | is | is | is | is | is |
Return Value: | 0 to11are integers between |
---|---|
JavaScript Version: | ECMAScript 1 |
Returns the month of the year from a specific date and time:
var d = new Date('August 20, 1999 23:15:30'); d.getMonth();Test and see‹/›
The month variable stores the name of the month:
var arr = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; var d = new Date(); var month = arr[d.getMonth()];Test and see‹/›