您的位置:首页 > Web前端 > JavaScript

js 指定日期加一天

2016-09-22 09:58 176 查看
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;当时间为月末,这里会自动加一个月。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息