对时间进行操作 加减 XXX天

date:要操作的时间目标
days: 要加减的天数时间
addDate: function(date, days) {
if (date == '') {
return ''
};
if (days == undefined || days == '') {
days = 0;
}
var timebox = new Date(date);
timebox.setDate(timebox.getDate() + days);
var month = timebox.getMonth() + 1;
var day = timebox.getDate();
return timebox.getFullYear() + '-' + month + '-' + day;
},
posted @ 2017-11-10 18:06  jimmy.wang123  阅读(179)  评论(0编辑  收藏  举报