Date.setYear() (Method)

Sets a non-Y2K compliant year number of the time object.

Availability:

ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Netscape Enterprise Server - 2.0
Opera - 3.0
Deprecated in JavaScript 1.3
Property/method value type:Time value
JavaScript syntax:-myDate.setYear(aYearNumber)
Argument list:aYearNumberIf the year number is less than 100, then 1900 is added to it.

The result returned by this method is the new time value of the containing object having been adjusted by the values passed in as arguments.

The computation is carried out in local time coordinates.

This method has difficulties with properly resolving the century, which is why it is deprecated and should be replaced by Date.setFullYear() in your scripts.

As of ECMA edition 3 it is no longer included in the standard, although implementations may still provide it for backwards compatibility.

Warnings:

See also:Date.getFullYear(), Date.getYear(), Date.prototype, Date.setFullYear()

Cross-references:

ECMA 262 edition 2 - section - 15.9.5.38

ECMA 262 edition 3 - section - B.2.5