C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...







JavaScript Date object's getYear()



This article explains about JavaScript Date object's getYear() method



getYear()



returns current year or year of specified date if year is specified.




<html>

<head>

<script>

function f()

{

var date = new Date ()

alert("Specified Year is "+ date.getYear("August 15 , 2006 01:17:00"))

}

</script>

</head>

<body>

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

</body>



As getYear() returns year out put is 2006

Note


getFullYear()Gets 4digits year ,where as getYear() returns 2 digits by default and depending on date specified it may return 4 digits too.

  • Next Chapter: Array object

  • Previous Chapter: Javascript date object's getMonth()

  • Tutorial Index



  • dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use