August 1999
Intermediate to advanced
1488 pages
72h 53m
English
date.setYear(year)
The setYear() method sets the year in the Date object to the argument year. The argument can be either a four-digit or two-digit integer. To create a two-digit representation, subtract 1900 from the desired date. The method returns an integer representing the number of milliseconds between midnight January 1, 1970 (GMT) to the date and time specified in the Date object after the year has been adjusted.
Caution
Prior to JavaScript 1.2, this method returned nothing.
The code in Listing 6.107 displays the current date in milliseconds before setting the year to 1983. Notice that the milliseconds specified ...
Read now
Unlock full access