Javascript Date addHours= function(h)

Description

Javascript Date addHours= function(h)


Date.prototype.addHours= function(h){
    this.setHours(this.getHours()+h);//from   w ww  .j  a v  a 2 s .c  o  m
    return this;
}
var d = new Date();
//console.log(d);
console.log(d.addHours(24));
//console.log(d);



PreviousNext

Related