[flexcoders] Re: What is the best way to add a day to a date?

2008-02-07 Thread rmarples
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() + / +

Re: [flexcoders] Re: What is the best way to add a day to a date?

2008-02-07 Thread Scott Melby
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:

[flexcoders] Re: What is the best way to add a day to a date?

2008-02-07 Thread rmarples
--- 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 =

[flexcoders] Re: What is the best way to add a day to a date?

2008-02-07 Thread Doug Lowder
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

Re: [flexcoders] Re: What is the best way to add a day to a date?

2008-02-07 Thread Muzak
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