//时间加月
function AddMouth(date, num){//date为格式化后的日期字符yyyy-MM-dd,num为增加的月份if(num){
var monthnum =parseInt(num);
var year =parseInt(date.substring(0,4));
var month =parseInt(date.substring(5,7));
var day =parseInt(date.substring(8,10));if(month + monthnum >12){
debugger;//算年
var yearstr =parseInt((month + monthnum)/12);
var newyear = year + yearstr;//算月
var monthstr =(month + monthnum)-(12* yearstr);
var newmonth =(monthstr +"").length ==1?"0"+ monthstr : monthstr;
var newday =(day +"").length ==1?"0"+ day : day;//判断闰年if(((year %4==0&& year %100!=0)||(year %400==0))&&month==2&&day==29&&num>=12){//到达的年份不是闰年if(!((newyear %4==0&& newyear %100!=0)||(newyear %400==0))){
newmonth =(monthstr +"").length ==1?"0"+(monthstr+1): monthstr;
newday ="01";}}}else{
var newyear = year
//算月
var monthstr = month + monthnum;
var newmonth =(monthstr +"").length ==1?"0"+ monthstr : monthstr;
var newday =(day +"").length ==1?"0"+ day : day;}
var newdate = newyear +"-"+ newmonth +"-"+ newday;return newdate;}return date;}