我想在我的日期中添加一天,我该怎么做 我的日期是日期 = 新日期((;
date = new Date();
endDate = this.date.toString();
date = new Date();
date.setDate(date.getDate() + 1);
endDate = this.date.toString();
更多详情
另一种用时刻来做到这一点的方法:
moment().add(1, 'day');
我认为使用这样的momentjs
要好得多:
moment(new Date().toString(), "DD-MM-YYYY").add(1, 'days')
甚至速记
moment().add(1, 'd');
在此处查看有关.add()
运营商的更多信息
这样使用
var date = new Date();
date.setDate(date.getDate()+1);
尝试:
date = new Date();
endDate = date;
endDate.setDate(date.getDate() + 1);
alert(endDate);
var now = new Date(); // Fri Feb 20 2015 19:29:31 GMT+0530 (India Standard Time)
var isoDate = new Date(now.getTime() - now.getTimezoneOffset() * 60000).toISOString();
//OUTPUT : 2015-02-20T19:29:31.238
试试这个!