2

I want to add one day to my date how can I do that my date is date = new Date();

date = new Date();
endDate = this.date.toString();
Harry Ninh
  • 16,288
  • 5
  • 60
  • 54
Debashish Dwivedi
  • 327
  • 2
  • 5
  • 13
  • Possible duplicate of [Incrementing a date in JavaScript](https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript) – Roman Aug 24 '17 at 05:55

6 Answers6

3
date = new Date();
date.setDate(date.getDate() + 1);
endDate = this.date.toString(); 

For more details

1

I think it is much nicer to use momentjs like:

 moment(new Date().toString(), "DD-MM-YYYY").add(1, 'days')

or even shorthand

moment().add(1, 'd');

checkout more on .add() operator here

angularrocks.com
  • 26,767
  • 13
  • 87
  • 104
1

Another way to do it with moment:

moment().add(1, 'day');
Junbang Huang
  • 1,927
  • 19
  • 26
1

Use This way

var date = new Date();
date.setDate(date.getDate()+1);
angularrocks.com
  • 26,767
  • 13
  • 87
  • 104
M K
  • 1,821
  • 4
  • 11
  • 22
0

Try :

date = new Date();
endDate = date;
endDate.setDate(date.getDate() + 1);

alert(endDate);
Yogesh Borkhade
  • 616
  • 5
  • 10
0
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

Try This!

HariKishore
  • 149
  • 8