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 2 2008 will be a 25- hour day in some locations due to the clocks being set back. You'd need to convert to UTC before doing the math, or check the timezone of the dates with getTimezoneOffset() and adjust accordingly if needed. --- In [email protected], "Kevin Aebig" <[EMAIL PROTECTED]> wrote: > > Yeah, that works too... =] > > !k > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Muzak > Sent: Thursday, February 07, 2008 4:16 PM > To: [email protected] > Subject: Re: [flexcoders] What is the best way to add a day to a date? > > or: > > var ms:Number = 24*60*60*1000; > var d:String = "2008/12/20"; > var newDate:Date = new Date(Date.parse(d)+ms); > > > ----- Original Message ----- > From: "Kevin Aebig" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Thursday, February 07, 2008 6:19 PM > Subject: RE: [flexcoders] What is the best way to add a day to a date? > > > > 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 > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.com > Yahoo! Groups Links >

