js 指定日期加一天

来源:互联网 发布:无印良品淘宝正品店铺 编辑:程序博客网 时间:2024/05/22 00:33
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;当时间为月末,这里会自动加一个月。

1 0