|
@ -184,4 +184,42 @@ function getYearEndDate() {
|
|
|
//本年最后
|
|
|
var currentYearLastDate=new Date(currentYear,11,31);
|
|
|
return formatDate(currentYearLastDate);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//获得昨天日期
|
|
|
function getYearEndDate() {
|
|
|
return getYesterday(-1, '-');
|
|
|
}
|
|
|
|
|
|
//近半年开始时间
|
|
|
function getHalfYearStartDate(){
|
|
|
var date = new Date();
|
|
|
date.setMonth(date.getMonth() - 6);
|
|
|
var year = date.getFullYear();
|
|
|
var month = date.getMonth() + 1;
|
|
|
month = (month < 10 ? "0" + month : month);
|
|
|
return year.toString() + '-' + month.toString() + "-01";
|
|
|
}
|
|
|
|
|
|
//近半年结束时间
|
|
|
function getHalfYearEndDate(){
|
|
|
var date = new Date();
|
|
|
var currentMonth = date.getMonth();
|
|
|
var nextMonth = ++currentMonth;
|
|
|
var nextMonthFirstDay = new Date(date.getFullYear(), nextMonth-1, 1);
|
|
|
var oneDay = 1000 * 60 * 60 * 24;
|
|
|
return(new Date(nextMonthFirstDay - oneDay)).format("yyyy-MM-dd");
|
|
|
}
|
|
|
|
|
|
function getYesterday(num, str){
|
|
|
var today = new Date();
|
|
|
var nowTime = today.getTime();
|
|
|
var ms = 24*3600*1000*num;
|
|
|
today.setTime(parseInt(nowTime + ms));
|
|
|
var oYear = today.getFullYear();
|
|
|
var oMoth = (today.getMonth() + 1).toString();
|
|
|
if (oMoth.length <= 1) oMoth = '0' + oMoth;
|
|
|
var oDay = today.getDate().toString();
|
|
|
if (oDay.length <= 1) oDay = '0' + oDay;
|
|
|
return oYear + str + oMoth + str + oDay;
|
|
|
}
|