标签:mon UNC date new jquer var current else ast
//将个数位日期转为07
function p(s) {
return s < 10 ? ‘0‘ + s: s;
}
//获取一个月日期
function getcurrent() {
//将一个月的日期填入搜索框
var currentYear=new Date().getFullYear();
var currentMonth=new Date().getMonth()+1;
var currentDate=new Date().getDate();
var current =currentYear+"-"+currentMonth+"-"+p(currentDate);
return current;
}
function getlastmonth() {
var currentYear=new Date().getFullYear();
var currentMonth=new Date().getMonth()+1;
var lastMonth=new Date().getMonth();
var currentDate=new Date().getDate();
var prevCurrentYear=0;
var prevCurrentMonth=0;
if(currentMonth==0){
prevCurrentYear=currentYear-1;
prevCurrentMonth=12;
}else{
prevCurrentYear=currentYear;
prevCurrentMonth=currentMonth-1;
}
var lastmonth=prevCurrentYear+"-"+prevCurrentMonth+"-"+p(currentDate)
return lastmonth;
}
标签:mon UNC date new jquer var current else ast
原文地址:https://www.cnblogs.com/telwanggs/p/9230737.html