The javascript () method returns the year on the specified date according to the common time. getYear is no longer used, and has been replaced by the getFullYear method.
The value returned by getYear is the current year minus 1900 (in JavaScript 1.2) and returns a year that is either a 2- or 4-digit number. For example, if the year is 2026, the returned value is 2026. So before testing this function, please make sure the version of JavaScript.
grammar
()
Here are the details of the parameters:
- NA
Return value:
Returns the year of the specified date according to the common time.
example:
<html> <head> <title>JavaScript getYear Method</title> </head> <body> <script type="text/javascript"> var dt = new Date(); ("getYear() : " + () ); </script> </body> </html>
This will produce the following results in 2012:
getYear() : 212