Here you can find the source of AddHours(hours)
Date.prototype.AddHours = function (hours) { return this.setHours(this.getHours() + hours); } Date.prototype.Format = function (fmt) { var o = {// w w w . ja va2s . c o m "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), "S": this.getMilliseconds() }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; };
Date.prototype.addHours = function(h) {
this.setHours(this.getHours() + h);
};
Date.prototype.addHours = function(hours) { this.setHours(this.getHours() + hours); return this; };
Date.prototype.addHours = function(n) { this.setHours(this.getHours() + n) }
Date.prototype.addHours = function (numberOfHours) { if (typeof numberOfHours !== 'number') throw new Error('Hours must be a number'); this.setTime(this.getTime() + (numberOfHours * 60 * 60 * 1000)); return this; };
Date.prototype.addHours = function (numberOfHours) { if (typeof numberOfHours !== 'number') throw new Error('Hours must be a number'); this.setTime(this.getTime() + (numberOfHours * 60 * 60 * 1000)); return this; }; var str = ' something else '; var r = str.toTitleCase();