js获取当前时间、前一星期时间、上个月的第一天和上个月的最后一天.
var curTime = new Date(); //获取当前时间
var oneTime = 1000*24*60*60;
var beforeTime = new Date(curTime - oneTime*7); //获取上星期时间
var beforeTime_1 = new Date(curTime - oneTime*(curTime.getDay()+6); //获取上周一时间。
var beforeMonthLast = new Date(curTime - curTime.getDate()*oneTime); //获取上个月最后一天
var beforeMonth_1 = new Date(curTime - (beforeMonthLast.getDate()-1)*oneTime); //获取上个月1号时间
console.log(curTime);
console.log(beforeTime);
console.log(beforeTime_1);
console.log(beforeMonthLast);
console.log(beforeMonth_1);