var nowdays = new Date(); var year = nowdays.getFullYear(); var month = nowdays.getMonth(); if(month==0){ month = 12; year = year-1; } if(month<10){ month = \'0\'+month; } var myDate = new Date(year,month,0); var startDate = year+\'-\'+month+\'-01 00:00:00\'; //上个月第一天 var endDate = year+\'-\'+month+\'-\'+myDate.getDate()+\' 23:59:00\';//上个月最后一天
![](https://image.shishitao.com:8440/aHR0cHM6Ly9jb21tb24uY25ibG9ncy5jb20vaW1hZ2VzL2Jhbm5lci8yMDIxL3ZvbGNlbmdpbmUtYzIuanBn.jpg?w=700)