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

today.setTime(today.getTime() - 24 * 60 * 60 * 1000);
document.write("1  day Before: "+today);
Output 
 Today: Sat Nov 29 2014 12:18:30 GMT+0530 (India Standard Time)
1 day Before: Fri Nov 28 2014 12:18:30 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