Date.getMonth()
Returns the month (from 0-11)
var moonLanding = new Date('July 20, 69 00:20:18');
console.log(moonLanding.getMonth()); // (January gives 0)
// expected output: 6
Syntax
dateObj.getMonth()Examples
Using getMonth()
getMonth()var Xmas95 = new Date('December 25, 1995 23:15:30');
var month = Xmas95.getMonth();
console.log(month); // 11References
Contributors to this page
Last updated