-1

I'm reciving a string with a date in d/m/Y format, and what I need is to convert it to a date and sum X days to it

Mark
  • 684
  • 2
  • 9
  • 25
  • can you ask what is exacty the pint you are missing? I have a date, I want to sum 1 day to this date, and I'm completely unable to do it, where is exactly the problem? – Mark Nov 15 '13 at 10:37
  • 1
    can you please post an example of the value, showing the exact format you receive the date? – melc Nov 15 '13 at 10:37
  • @Mark I guess I'm missing everything from the context to the code example. – VisioN Nov 15 '13 at 10:38
  • where is the problem? can you re re read please? :) – Mark Nov 15 '13 at 10:41
  • The content is edited, dunno how to explain if now it stills hard tu understand what I'm trying to ask – Mark Nov 15 '13 at 10:52

1 Answers1

1
var ajaxDate = [populate with the date from ajax]
var date = new Date(ajaxDate);
var numberOfDaysToAdd = 1;

date.setDate(someDate.getDate() + numberOfDaysToAdd); 

Formatting to d/m/y :

var d = date.getDate();
var m = date.getMonth() + 1;
var y = date.getFullYear();

var dormattedDate = d + '/'+ m + '/'+ y;

from How to add number of days to today's date?

Community
  • 1
  • 1
alex
  • 646
  • 9
  • 19