var now = new Date(); //当前日期
var nowDayOfWeek = new.getDay(); //本周的第几天
var nowMonth = new.getMonth(); //当前月
var nowYear = new.getYear()+1900; //当前年
var nowY = new Date(newYear, 0, 1); //今年第一天
var nowM = new Date(newYear, nowMonth, 1); //本月第一天
var nowF = new Date(newYear-1, 0, 1); //去年第一天
var nowL = new Date(newYear-1, 11, 31); //去年最后一天
var prevDate = new Date(newYear,newMonth,0); //上月最后一天
var pervDateF = new Date(newYear,newMonth-1, 1); //上月第一天
Date.format('yyyy-MM-dd'); //格式化时间;
//封装一个获取时间的方法
var GetDateStr = function (num) {
var dd = new Date();
dd.setDate(dd.getDate()+num); //获取num天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1; //获取当前月份的日期
var d = dd.getDate(); return y+"-"+m+"-"+d;
};
var weekB = -(nowDayOfWeek-1);
var weekP = -(nowDayOfWeek+6);
GetDateStr(weekB); //本周一
GetDateStr(weekP); //上周一
GetDateStr(weekP+6); //上周末