Tutorials » Javascript tutorials »

Javascript date object's getMonth()

This article explains date object's getMonth() method


returns current month code of current Date or month code of specified date.




function f()


var date = new Date ("August 21, 2006 01:15:00")






<input type ="button" value ="Click to get month" onclick ="return f();" >


As get month returns an integer between 0 and 11, it will return 7 for August month
In order to get correct results we increment it by 1 .We get output as 8.

Next Chapter: JavaScript Date object's getYear()
Previous Chapter: Date object's' getDate() method
More Chapters: Javascript Tutorials
More Tutorials: Tutorial Index

Top Contributors
TodayLast 7 Daysmore...

Awards & Gifts

Online Members

Ramesh Muthiah
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India