Pages

Javascript Date getYear() Method

Description:

Javascript date getYear() method returns the year in the specified date according to universal time. The getYear is no longer used and has been replaced by the getFullYear method.
The value returned by getYear is the current year minus 1900. JavaScript 1.2 and earlier eturns either a 2-digit or 4-digit year, for example if the year is 2026, the value returned is 2026. So before testing this function make sure the version about the javascript version.

Syntax:

Date.getYear()
Here is the detail of parameters:
  • NA

Return Value:

Returns the year in the specified date according to universal time.

Example:

<html>
<head>
<title>JavaScript getYear Method</title>
</head>
<body>
<script type="text/javascript">
   var dt = new Date();
   document.write("getYear() : " + dt.getYear() ); 
</script>
</body>
</html>
This will produce following result for the year 2008 :
getYear() : 208
 
 
+JavaScript +JavaScript Frameworks Links +Javascript Development 
+JavaScript's and More, Software and Marketing +JavascriptU +JavaScriptOn 
+Javascript Problems +JavaScriptOn 
 +javaScript is a creek in West Virginia in the summe  
+enJineS +JavascriptU +Javascript Tutor  
  
  

No comments:

Flag Counter
| Copyright © 2013 Remote Tutor