JavaScript 1.3 Overview, Part I: New Date Methods - Doc JavaScript
New Date Methods
JavaScript 1.3 introduces new and modified Date
methods to support a full-year notation, milliseconds, and Universal Coordinate Time. The following table summarizes the new methods:
Method | getFullYear() |
Parameters | None |
Description | Returns the year of the specified date according to local time. |
Example | var myBirthYear; |
JavaScript 1.2 | getYear() |
Method | setFullYear() |
Parameters | <year>(mandatory) <month>(optional) <day of the month>(optional) |
Description | Sets the year of the specified date according to local time. If you don't specify the <month> and <day of the month>, the values returned from getMonth() and getDate() are used. Notice you cannot specify the <day of the month> without specifying the <month>. If you specify a parameter outside its expected range, other parameters will be updated accordingly. If, for example, you specify 15 for the <month>, the <year> will be incremented by one, and the <month> will be set to 3 . |
Example | var myBirthYear; |
JavaScript 1.2 | setYear() |
Method | getMilliseconds() |
Parameters | None |
Description | Returns the milliseconds in the specified date according to local time. The return value is between 0 and 999 . |
Example | var myBirthDayMS; |
JavaScript 1.2 | None |
Method | setMilliseconds() |
Parameters | <milliseconds> |
Description | Sets the milliseconds in the specified date according to local time. The parameter value should be between 0 and 999 . If you specify a number outside this range, other date variables in the Date object will be incremented to accommodate your number. If you specify 1012 , for example, the number of milliseconds in the Date object will be 12 and the number of seconds will be incremented by 1 . |
Example | myBirthDate = new Date(); |
JavaScript 1.2 | None |
Method | toUTCString() |
Parameters | None |
Description | Converts a date to a string, using UTC convention. This method behaves the same as toGMTString() , but you should use the toUTCString() instead. The latter is kept for backward compatibility purposes only. |
Example | var myBirthMonth; |
JavaScript 1.2 | getMonth() |
Created: September 14, 1998
Revised: September 14, 1998
URL: https://www.webreference.com/js/column25/datenew.html