let today = new Date().getTime(); let lastDay = getTimeByDay(30) //获取30天后的日期 /* num 获取当天多少天后的日期 */ function getTimeByDay(num) { return today + 60 * 60 * 1000 * 24 * num; }