js 一段时间后的日期

Date.prototype.dateAdd = function(interval,number)

{

var d = this;

var k={'y':'FullYear', 'q':'Month', 'm':'Month', 'w':'Date', 'd':'Date', 'h':'Hours', 'n':'Minutes', 's':'Seconds', 'ms':'MilliSeconds'};

var n={'q':3, 'w':7};

eval('d.set'+k[interval]+'(d.get'+k[interval]+'()+'+((n[interval]||1)*number)+')');

return d;

}


你可能感兴趣的:(js,日期)