You may have already solved this but I’m finally catching up on flexcoders…

 

I believe the DateFormatter will be able to parse the Date string and therefore allow you to place it in your DataGrid.  The formatString would probably be something like: “YYYY-MM-DD HH:NN:SS”

 

Then you give your DataGridColumn a labelFunction, and the labelFunction would clal the formatter.

 

<mx:DateFormatter id=”df” formatString=” YYYY-MM-DD HH:NN:SS” />

 

<mx:Script>

  function labelFunc(item) : String

  {

    Return df.format(item);

  }

</mx:Script>

 

<mx:DataGrid …>

  <mx:columns>

    <mx:Array>

      <mx:DataGridColumn … lableFunction=”labelFunc” />

      …

 

Adjust as appropriate J

 

Matt

 

 


From: teddybearneo [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 12, 2005 3:58 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Parsing date time returned from a webservice call

 


Hello,

I have a remote Coldfusion CFC returning a query of sales orders.

In this query there is a field containing the date/time of the order (encoded in a DATETIME
field in a mySQL table).

When called, this CFC returns a wddx (xml) packet with the data (query).
In this packet the date/time is encoded in the following format :
2005-4-11T16:55:42+1:0
When I bind this query to a datagrid in a Flex application, the date/time is shown as :
Monday Apr 11 16:55:42 GMT+0200 2005

When I trace in the Network monitor, I see that the returned xml packet contains :
xsd:dateTime 2005-04-11T14:55:42.000z
The SOAP response is the same
and the WebService onResult is :
Mon Apr 11 16:55:42 2005 (+-2:00)
wich is what is (nearly) shown in the datagrid.

What must I do to have the date/time format in the datagrid shown as, for example,
2005-04-11 16:55:42

so i can correctly sort the grid. For the moment, as the day of the week begin the format,
this column sorts by day of week first.

Do I have to use DateFormatter, and if yes, with wich exact syntax ?

Many thanks.







Yahoo! Groups Links

Reply via email to