var now = new Date();//获取当前时间
var nowMs = now.getTime();//获取当前时间的毫秒数
var beforeMs = nowMs - 1000 * 60 * 60 * 24 * parseInt(n);//前几天,n就取几,整数
var beforeDate = new Date().setTime(beforeMs );
beforeDate 就是要去的日期
用循环来做的话,就能得出前七天,后7天等
var now = new Date();//获取当前时间
var nowMs = now.getTime();//获取当前时间的毫秒数
var beforeMs = nowMs - 1000 * 60 * 60 * 24 * parseInt(n);//前几天,n就取几,整数
var beforeDate = new Date().setTime(beforeMs );
beforeDate 就是要去的日期
用循环来做的话,就能得出前七天,后7天等