var now=new Date();
一周前的时间=(now.getFullYear()) + '-' + (now.getMonth()+1) + '-' + (now.getDate());
var date = new Date(now.getTime() - 7 * 24 * 3600 * 1000);
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
当前时间=year+"-"+month+"-"+day;
var time=new Date();
var year=time.getFullYear();//当前年份
var month=time.getMonth()+1;//当前月份
var day=time.getDate();//当前日期
var date=time.getDay();//星期几
var currentTime=time.toLocaleDateString(); //获取当前日期
var current=time.toLocaleTimeString(); //获取当前时间