js 实现增加天函数
废话不多说,直接看代码function getFormatDate(arg) { if (arg == undefined || arg == '') { return ''; } var re = arg + ''; if (re.length < 2) { re = '0' + re; } return re; } function addDate(date, days) { if (days == undefined || days == '') { days = 0; } var date = new Date(date); date.setDate(date.getDate() + days); var month = date.getMonth() + 1; var day = date.getDate(); return date.getFullYear() + '-' + getFormatDate(month) + '-' + getFormatDate(day); }
页:
[1]