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();//上个月的最后一天

}

posted on 2017-07-20 09:57  luyaozhimali  阅读(422)  评论(0编辑  收藏  举报