function addDate() {
var days = -1;//获取前一天,获取后一天则为正 var d = new Date("2017-09-09"); d.setDate(d.getDate() + days); var month = d.getMonth() + 1; var day = d.getDate(); if(month < 10) { month = "0" + month; } if(day < 10) { day = "0" + day; } var val = d.getFullYear() + "-" + month + "-" + day; $(".curDate").text(val); }