生成3个月前的时间日期
1
var currDate = new Date(); year = currDate.getFullYear(); month = currDate.getMonth() + 1; date = currDate.getDate(); hour = currDate.getHours(); minute = currDate.getMinutes(); second = currDate.getSeconds(); switch (month) { case 1: case 2: case 3: month += 9; year--; break; default: month -= 3; break; } var datechar = year + "-" + (month > 9 ? month : "0" + month) + "-" + (date > 9 ? date : "0" + date) + " " + hour + ":" + minute + ":" + second; //return datechar; console.log(datechar);
1
浙公网安备 33010602011771号