Javascript Date subtractDays(days)
Date.prototype.subtractDays = function(days) { var dat = new Date(this.valueOf()); dat.setDate(dat.getDate() - days);//from ww w .j ava 2 s .c o m return dat; }
//subtract days from a date Date.prototype.subtractDays=function(days){ if (arguments.length===1){ if (typeof days !== 'number') return; this.setDate(this.getDate() - days); return this; }/*from w w w. j a va 2 s.c o m*/ return this; }