Ok, wrote a simple solution myself for a string in this format:
"yyyy-mm-dd hh:mm:ss"
public function String2Date(doString:String):Date {
var doYear:int = Number(doString.substr(0,4));
var doMonth:int = Number(doString.substr(5,2));
var doDay:int = Number(doString.substr(8,2));
var doHour:int = Number(doString.substr(11,2));
var doMin:int = Number(doString.substr(14,2));
var doSec:int = Number(doString.substr(17,2));
var myDate:Date = new Date(doYear, doMonth, doDay, doHour, doMin, doSec);
return myDate;
}
--- In [email protected], "Michael Labriola" <[EMAIL PROTECTED]>
wrote:
>
> Frank,
>
> The problem is that the dateField is looking for a Flex Date object.
> Guessing from the conversion to XML, the x.result[0].arrivaldate[0] is
> an XML node which contains a String. This String needs to be made into
> a Flex Date Object.
>
> There are a few ways to do this: var myDate:Date = new Date( y, m, d,
> h, m, s ); and parse it manually. Many people have spun there own code
> to do this, however, this might also be a resource for you:
>
>
http://labs.adobe.com/wiki/index.php/ActionScript_3:resources:apis:libraries
>
> There are a few methods in DateUtil for parsing a string into dates.
>
> --Mike
>
> --- In [email protected], "amigo_fd" <frank@> wrote:
> >
> > Hello,
> >
> > I have a webservice which loads from a database with ASP.NET C#. Dates
> > are converted into the following format:
> >
> > ToString("yyyy/MM/dd HH:mm:ss")
> > For instance: 2002/09/01 00:00:00
> >
> > Within Flex they are assigned to a DateField with:
> >
> > var x:XML = new XML(WsImports.WsGetImportData.lastResult);
> > dfArrival.selectedDate = x.result[0].arrivaldate[0];
> >
> > But I get the error:
> > cannot convert [EMAIL PROTECTED] element <arrivaldate> to Date
> >
> > Any ideas what would be the correct dateformat to use them in Flex ?
> >
> > Thanks a lot,
> > Frank
> >
>
--
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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/