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;當時間爲月末,這裏會自動加一個月。

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