C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...








Javascript date object's getMonth()



This article explains date object's getMonth() method





getMonth()



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




<html>

<head>

<script>

function f()

{

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

document.write(date.getMonth()+1)

}

</script>

</head>

<body>

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

</body>



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


Tutorial Index




dotNet Slackers   BizTalk Adaptors    Web Design

SPOC

Contact Us    Privacy Policy    Terms Of Use