日期:2014-05-16 浏览次数:20400 次
function dateAdd(date,strInterval, Number) { //参数分别为日期对象,增加的类型,增加的数量
var dtTmp = date;
switch (strInterval) {
case 'second':
case 's' :
return new Date(Date.parse(dtTmp) + (1000 * Number));
case 'minute':
case 'n' :
return new Date(Date.parse(dtTmp) + (60000 * Number));
case 'hour':
case 'h' :
return new Date(Date.parse(dtTmp) + (3600000 * Number));
case 'day':
case 'd' :
return new Date(Date.parse(dtTmp) + (86400000 * Number));
case 'week':
case 'w' :
return new Date(Date.parse(dtTmp) + ((86400000 * 7) * Number));