function getLastQuarter(){
var today = new Date();
var dayMSec = 24 * 3600 * 1000;
//得到上一个季度的第一天
var lastQuarterFirstDay = new Date(today.getFullYear() , today.getMonth() - 3 , 1);
//得到本月第一天
var nowMonthFirstDay = new Date(today.getFullYear() , today.getMonth(), 1);
//得到上一个季度的最后一天的毫秒值
var lastQuarterLastDayMSec = nowMonthFirstDay.getTime() - 1 * dayMSec;
var lastQuarterLastDay = new Date(lastQuarterLastDayMSec);
return lastQuarterFirstDay.format('yyyy-MM-dd') +","+lastQuarterLastDay.format('yyyy-MM-dd');
}
js获取时间(上一个季度)
最新推荐文章于 2024-05-13 14:28:48 发布