[flexcoders] Re: Convert String to Date?

2008-09-16 Thread nathanpdaniel
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 flexcoders@yahoogroups.com, Mark Easton [EMAIL PROTECTED] wrote:

 Good stuff - thanks!
 
 
   _  
 
 From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
 Behalf Of Tim Rowe
 Sent: Tuesday, September 16, 2008 1:00 PM
 To: flexcoders@yahoogroups.com
 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 
 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





[flexcoders] RE: Convert String to Date?

2008-09-15 Thread Mark Easton
I guess I can modify the date format returned by MySQL ... ie
date_format(last_modified, '%a %b %e %Y %r') ... but still, flex is pretty
limited here.


  _  

From: Mark Easton [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 16, 2008 12:22 PM
To: 'flexcoders@yahoogroups.com'
Subject: 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.com/serv?s=97359714/grpId=12286167/grpspId=1705007207/msgI
d=125320/stime=1221523430/nc1=4507179/nc2=3848641/nc3=4836036