Create a date object with the string, than add the day to it like this:

 

newDate = new Date(a[0], a[1], a[2]);

newDate.seconds += 8640; // seconds in a day or (60*60*24)

 

!k 

 

  _____  

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mark
Sent: Thursday, February 07, 2008 8:40 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] What is the best way to add a day to a date?

 

I'm getting dates in my XML formatted like this:

2008/12/20

In some cases in my Flex app I need to add 1 day to that date. What 
is the best way to do that? Right now I'm working it out this way:

s = chartDates.getItemAt(0).globalDeadline;
a = s.split("/");
newDate = a[0]+"/"+a[1]+"/"+(Number(a[2])+1);

But I'm pretty sure this isn't right.

Can someone help out with the code?

Thanks
-M

 

Reply via email to