Microsoft® JScript® getYear Method |
Language Reference Version 1 |
Returns the year value in a Date object.
objDate.getYear( )
This method is obsolete, and is provided for backwards compatibility only. Use the getFullYear method instead.For years from 1900 through 1999, the year is a 2-digit integer value returned as the difference between the stored year and 1900. For other dates, the 4-digit year is returned. For example, 1996 is returned as 96, but 1825 and 2025 are returned as-is.
The following example illustrates the use of the getYear method:
function DateDemo() { var d, s = "Today's date is: "; d = new Date(); s += (d.getMonth() + 1) + "/"; s += d.getDate() + "/"; s += d.getYear(); return(s); }