Gets the year of a Date object. Deprecated in favor of getFullYear method.
- The required dateObj reference is a Date object.
Returns the year.
Important – This method is obsolete, and is provided for backward compatibility only. Use the getFullYear method instead.
In Internet Explorer 3.0, and then in Internet Explorer versions starting with Internet Explorer 9 standards mode, the value returned is the stored year minus 1900. For example, the year 1899 is returned as -1 and the year 2000 is returned as 100.
In Internet Explorer 4.0 through Internet Explorer 8 standards mode, the formula depends on the year. For the years 1900 through 1999, the value returned is a 2-digit value that is the stored year minus 1900. For dates outside that range, the 4-digit year is returned. For example, 1996 is returned as 96, but 1825 and 2025 are returned as is.
- getFullYear Method (Date)
- getUTCFullYear Method (Date)
- setFullYear Method (Date)
- setUTCFullYear Method (Date)
- setYear Method (Date)
Microsoft Developer Network: Article