Knowledge Walls
Laya
Hyderabad, Andhra Pradesh, India
Date.prototype.setFullYear() Method in Date Class of Javascript Syntax with Examples
2058 Views
Usage  
The setFullYear() method is used to sets the full year for mentioned date based on local time.
Syntax 
dateObj.setFullYear(yearValue[, monthValue[, dayValue]])
Example
var today = new Date();
document.write("Today: "+today);
document.write("<br />");

today.setFullYear(today.getFullYear() - 1);
document.write("1 Year Before: "+today);
Output  
Today: Sat Nov 29 2014 12:05:51 GMT+0530 (India Standard Time)
1 Year Before: Fri Nov 29 2013 12:05:51 GMT+0530 (India Standard Time)
 
Best Lessons of "Javascript Syntax with Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details