0

I have this JavaScript extension for for IDE. My question is how can i add days e.g. 3 days in arriveDate variable?

example: the result of arriveDate is 10/11/2014, now i want to add another 3 days on that.

var someDate = new Date();
var numberOfDaysToAdd = 150;
someDate.setDate(someDate.getDate() + numberOfDaysToAdd); 
var dd = someDate.getDate();
var mm = someDate.getMonth() + 1;
var y = someDate.getFullYear();
var arriveDate = mm + '/'+ dd + '/' + y;

Thanks for answering my question.

  • See http://stackoverflow.com/questions/563406/add-days-to-datetime – Justin Bicknell May 14 '14 at 22:19
  • You're already adding days to a Date object. Just do that same thing, except with 3 days instead of 150. Make `arriveDate` a Date object, add the 3 days, then use `.toDateString()` or `.toLocaleString()` to put it in the format you want. – Jonathan M May 14 '14 at 22:21
  • What specifically is not working? Your code works perfectly: http://jsfiddle.net/ACRn2/ – I wrestled a bear once. May 14 '14 at 22:31
  • Can you show me sample. I want to add another 3 days on the results of arriveDate? Like on my sample script. the result of is 10/11/2014 then I want to add another 3 days on that? Thanks for helping. – user3638624 May 14 '14 at 23:59

0 Answers0