我必须计算三个日期形式的明天。例如todayes日期是1-12-2016
所以未来三日将是2-12-2016 , 3-12-2016 , 4-12-2016
如何从今天的日期得到下三个日期
我能够做到这一点在这种情况下,但我的问题是,如果我的日期是30
或31
我是获取日期为32, 33, 34
,但我必须让1, 2, 3
这里是我的代码
this.today = new Date();
this.tommorowDate =this.today.setDate(this.today.getDate() + 1)
console.log(this.tommorowDate)
this.dd = this.today.getDate();
this.mm = this.today.getMonth()+1;
this.yyyy = this.today.getFullYear();
this.currentDate = this.dd+'/'+this.mm+'/'+this.yyyy;
for(var i = 1; i <= 3; i++){
var incrementdate = this.dd+i;
this.datepickerArray.push(this.yyyy+'-'+this.mm+'-'+incrementdate)
}
我this.datepickerArray为[31-1-2017,32-1-2017,33-1-2017。
但我必须像这样[31-1-2017,1-2-2017,2-2-2017]。
我能够得到明天的日期,但使用该如何得到我的数组更新与下个月。
看看[this](http://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript)。 – xzoert
看到这个http://stackoverflow.com/questions/3818193/how-to-add-number-of-days-to-todays-date –
可能重复的[添加日期到JavaScript日期](http:// stackoverflow。 com/questions/563406/add-days-to-javascript-date) –