JavaScript Basics
JavaScript Objects
JavaScript Advanced
JS Useful References
JS Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Javascript Date setYear() Method
Description:
Javascript date setYear() method sets the year for a specified date according to universal time.
Syntax:
Note: Paramters in the bracket are always optional
Here is the detail of parameters:
Return Value:
NA
Example:
<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.
|
|
|