Sorry, first post didn't come through properly. Try this:
var origDateString:String = 2008/12/31;
var dateItems:Array = origDateString.split(/);
var newDate:Date = new Date(dateItems[0], Number(dateItems[1])-1,
Number(dateItems[2])+1);
var newDateString:String = newDate.getFullYear() + / +
seems doing this you could easily end up with 2008/12/32 :)
I'd parse the data, then create a Date object. Adding a day to a Date
should be as simple as
myDate.time += (24 * 60 * 60 * 1000);
hth
Scott
Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com
rmarples wrote:
--- In flexcoders@yahoogroups.com, Mark [EMAIL PROTECTED] wrote:
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 =
It's not that simple, because of Daylight Savings Time. Try the
following on a machine with the timezone set to something that
follows DST:
var ms:Number = 24*60*60*1000;
var d:String = 2008/11/02;
var newDate:Date = new Date(Date.parse(d)+ms);
You'll get the same day, 2008/11/02, because Nov
Works fine here using 2008/11/02 as the starting date, but that's probably
because winter time kicks in on a different date here
(which I don't know).
Summer time kicks in on 2008/03/30 so I tried that instead.
Notice that the new date has 1 hour added.
I guess when using the winter time it
5 matches
Mail list logo