js 指定日期加一天

function dateAdd(startDate) {
        startDate = new Date(startDate);
        startDate = +startDate + 1000*60*60*24;
        startDate = new Date(startDate);
        var nextStartDate = startDate.getFullYear()+"-"+(startDate.getMonth()+1)+"-"+startDate.getDate();
        return nextStartDate;

    }

这里的startDate是我从别的地方传过来的,可以自定义时间, startDate = +startDate + 1000*60*60*24;当时间为月末,这里会自动加一个月。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章