Tutorials » Javascript tutorials »

JavaScript Date object's getYear()

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


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




function f()


var date = new Date ()

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





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


As getYear() returns year out put is 2006


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()
More Chapters: Javascript Tutorials
More Tutorials: Tutorial Index

Top Contributors
    Last 7 Daysmore...

    Awards & Gifts

    Online Members

    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India