There's also the DateUtil class in corelib... http://code.google.com/p/as3corelib/ and specifically: DateUtil.parseRFC822(str:String):Date DateUtil.parseW3CDTF(str:String):Date Hope this helps! :D
--- In [email protected], "Mark Easton" <[EMAIL PROTECTED]> wrote: > > Good stuff - thanks! > > > _____ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Tim Rowe > Sent: Tuesday, September 16, 2008 1:00 PM > To: [email protected] > Subject: RE: [flexcoders] Convert String to Date? > > > > I had the same thing just a few weeks ago. Note here that I'm already > passing the date back 0-based and not passing the time, but this will > essentially do what you want. > > private function parseDates(data:String):Date { > // Get an array of Strings from the comma-separated String > passed in. > var a:Array = data.split("-"); > > // Create the new Date object. Note that the month argument is > 0-based (with 0 being January). > var newDate:Date = new Date(a[0],a[1],a[2]); > return newDate; > } > > Enjoy. > > Tim Rowe > Software Engineer > carsales.com Ltd > > Level 1, 109 Burwood Road > Locked Bag 3333 > Hawthorn VIC 3211 > > t: 03 9093 8600 (Reception) > t: 03 9093 8757 (Direct) > f: 03 9093 8697 > > ________________________________ > > From: [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.com > [mailto:[EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.com] > On > Behalf Of Mark Easton > Sent: Tuesday, 16 September 2008 10:22 AM > To: [EMAIL PROTECTED] <mailto:flexcoders%40yahoogroups.com> ups.com > Subject: [flexcoders] Convert String to Date? > > Gosh, I cant believe I am asking this question. But, other than parsing > the string I cannot see anyway to obviously convert my string to a date > format. My string is returned from a SQL query and passed to my app via > XML. > > So my string is in the format: YYY-MM-DD HH:M:SS. This is a standard > SQL format. So why can I not easily convert that in to a date format in > flex? > > I have looked at the Date and DateField classes but no help there. > DateField.stringToDate for instance only accepts date formats (no time). > Date for instance wants a date in the format (as follows) ... > > var date:Date = new Date("Mon May 1 2006 11:30:00 AM"); > > Hmmm - what a pain! Any one have a solution? > > TIA > Mark > > > > > <http://geo.yahoo. > <http://geo.yahoo.com/serv? s=97359714/grpId=12286167/grpspId=1705007207/> > com/serv?s=97359714/grpId=12286167/grpspId=1705007207/ > msgId=125320/stime=1221523430/nc1=4507179/nc2=3848641/nc3=4836036> >

