//获取上一个月
function changeMonth(){
//上月
var now = new Date();
now.setTime(now.getTime()-24*60*60*1000);
var year = now.getFullYear();
var month = now.getMonth();
if(month == 0){
year = year -1;
month = 12;
}
if (month < 10)
month = "0" + month;
var lastMonth = year.toString()+ month.toString();
$("#auditCycle").datepicker({
language : "zh-CN",
todayHighlight : true,
format : 'yyyymm',
autoclose : true,
startView : 'months',
maxViewMode : 'years',
minViewMode : 'months'
});
$("#auditCycle").val(lastMonth);
return lastMonth;
}
//获取当前月
function changeMonth() {
var now = new Date();
now.setTime(now.getTime() - 24 * 60 * 60 * 1000);
var year = now.getFullYear();
var month = now.getMonth() + 1;
if (month < 10)
month = "0" + month;
var lastMonth = year.toString() + month.toString();
$("#auditCycle").datepicker({
format: 'yyyymm',
weekStart: 1,
autoclose: true,
// startView: 3,
maxViewMode: 1,
minViewMode: 1
}).on("changeDate",function(){
changeDate(this)
});;
$("#auditCycle").val(lastMonth);
return lastMonth;
}
//获取昨天日期
function dailyInitDate1(){
//昨日
var now = new Date();
now.setTime(now.getTime()-24*60*60*1000);
var year = now.getFullYear();
var month = now.getMonth();
var date = now.getDate();
month = month + 1;
if (month < 10)
month = "0" + month;
if (date < 10)
date = "0" + date;
var lastMonth = year.toString()+ month.toString() + date.toString();
$("#auditCycle").datepicker({
format: 'yyyymmdd',
language: 'zh-CN',
todayBtn : "linked",
autoclose:true,
minview : "3"
});
$("#auditCycle").val(lastMonth);
return lastMonth;
}
//获取当日日期
function dailyInitDate1(){
//当日
var now = new Date();
now.setTime(now.getTime()-24*60*60*1000);
var year = now.getFullYear();
var month = now.getMonth();
var date = now.getDate() + 1;
month = month + 1;
if (month < 10)
month = "0" + month;
if (date < 10)
date = "0" + date;
var lastMonth = year.toString()+ month.toString() + date.toString();
$("#auditCycle").datepicker({
format: 'yyyymmdd',
language: 'zh-CN',
todayBtn : "linked",
autoclose:true,
minview : "3"
});
$("#auditCycle").val(lastMonth);
return lastMonth;
}