Copyright © tutorialspoint.com
Javascript date setYear() method sets the year for a specified date according to universal time.
Date.setYear(yearValue) |
Note: Paramters in the bracket are always optional
Here is the detail of parameters:
yearValue : An integer value.
NA
<html> <head> <title>JavaScript setYear Method</title> </head> <body> <script type="text/javascript"> var dt = new Date( "Aug 28, 2008 13:30:00" ); dt.setYear( 2000 ); document.write( dt ); </script> </body> </html> |
This will produce following result :
Mon Aug 28 13:30:00 UTC+0530 2000 |
To understand it in better way you can Try it yourself.
Copyright © tutorialspoint.com