js 实用功能效果

js获取上个月时间

var myDate = new Date();
    var year = myDate.getFullYear();
    var month = myDate.getMonth();
    if (month<10){
        month = "0"+month;
    }
    var firstDay = month+"/"+"01/"+year;
alert(firstDay);

    myDate = new Date(year,month,0);
    var lastDay = month+"/"+myDate.getDate()+"/"+year;
   // var firstTime = "00:00:00";
    //var lastTime = "23:59:59";
 alert(lastDay);

http://www.studyofnet.com/news/1180.html

 

posted @ 2017-09-29 18:52  haveProgress  阅读(71)  评论(0编辑  收藏  举报