js获取上个月的时间.txt function dealTimeFormatter(value,row,index){if(value==null){return "";}var day=Math.floor(value/(24*60*60*1000));var ho='';var mi='';if(day0){ho=Math.floor((value-(24*60*60*1000*day))/(60*60*1000));if(ho0){mi=
function dealTimeFormatter(value,row,index){ if(value==null){ return ""; } var day=Math.floor(value/(24*60*60*1000)); var ho=''; var mi=''; if(day>0){ ho=Math.floor((value-(24*60*60*1000*day))/(60*60*1000)); if(ho>0){ mi=Math.floor((value-(24*60*60*1000*day)-(60*60*1000*ho))/(60*1000)); }else{ mi=Math.floor((value-(24*60*60*1000*day))/(60*1000)); } }else{ ho=Math.floor(value/(60*60*1000)); if(ho>0){ mi=Math.floor((value-(60*60*1000*ho))/(60*1000)); }else{ mi=Math.floor(value/(60*1000)); } } if(day>0){ day+='天'; }else{ day=''; } if(ho>0){ ho+='小时'; }else{ ho=''; } if(mi>0){ mi+='分钟'; }else{ mi=''; } return (day+ho+mi)==''?'1分钟':(day+ho+mi); } //获取下个月的时间 function lastMonthDate(){ var Nowdate = new Date(); var vYear = Nowdate.getFullYear(); var vMon = Nowdate.getMonth() + 1; var vDay = Nowdate.getDate(); //每个月的最后一天日期(为了使用月份便于查找,数组第一位设为0) var daysInMonth = new Array(0,31,28,31,30,31,30,31,31,30,31,30,31); if(vMon==1){ vYear = Nowdate.getFullYear()-1; vMon = 12; }else{ vMon = vMon -1; } if(vYear%4 == 0 && vYear%100 != 0){//若是闰年,二月最后一天是29号 daysInMonth[2]= 29; } if(daysInMonth[vMon] < vDay){ vDay = daysInMonth[vMon]; } if(vDay<10){ vDay="0"+vDay; } if(vMon<10){ vMon="0"+vMon; } var date =vYear+"-"+ vMon +"-"+vDay; console.log(date) return date; }