Returns the year value in the Date object using local time.
The required dateObj reference is a Date object.
To get the year using Universal Coordinated Time (UTC), use the getUTCFullYear method.
The getFullYear method returns the year as an absolute number. For example, the year 1976 is returned as 1976.
The following example illustrates the use of the getFullYear method.
var d, s = "Today's date is: ";
d = new Date();
s += (d.getMonth() + 1) + "/";
s += d.getDate() + "/";
s += d.getFullYear();
Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards. See Version Information.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback