add 2 hours to new date javascript code example
Example 1: date add hours javascript
Date.prototype.addHours = function(h) {
this.setTime(this.getTime() + (h*60*60*1000));
return this;
}
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));