date time add 1 sec javascript code example
Example 1: add 10 seconds to date javascript
var d;
d = new Date('2014-01-01 10:11:55');
alert(d.getMinutes() + ':' + d.getSeconds()); //11:55
d.setSeconds(d.getSeconds() + 10);
alert(d.getMinutes() + ':0' + d.getSeconds()); //12:05
Example 2: add 2 for hours in date timestamp js
Date.prototype.addHours= function(h){
this.setHours(this.getHours()+h);
return this;
}
alert(new Date().addHours(4));