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 firstDay = year + "-" + month + "-" + "01";//上个月的第一天
var myDate = new Date(year, month, 0);
var lastDay = year + "-" + month + "-" + myDate.getDate();//上个月的最后一天
}