Hi Guys,
I have a date field which is coming into Flash from a .net webservice. It is being called on from a webservice class (not a component...and not my choice). But the date field comes into flash formatted like this.
Wed Dec 24 00:00:00 GMT+1000 2003
I was curious to know if there was a simple way to format this date in flash to display the date like this.
No... There isn't really easy way to change that format...
It might not be the closest one, but I have seen a couple of date format related prototypes at Layer51... http://proto.layer51.com
Go check it out and modify the script and I think it will be easier to do it that way...
Please do not crosspost... We hate people doing that... Besides, this question does not really have much to do with that server side forum except that you are calling a web service...
I don't get what you/he mean by that
but if you know the format you can do it by a simple array and a subString or a subStr to split it and reorganise it
You don't need arrays for that, I am just kinda used to them.
You can join it all in a single string also.
You can format the year as 03, or you can leave it in YYYY format,
Hope this helps.
i need to do the same thing, except in my case, i am using components
A webserviceConnect, a DataSet and a DataGrid.
The date ends up in the grid with that extremly long formatting. I tried to change the components to format that field but it dosnt work.
Step 1: In your mxml file (where you have the data grid) declare a date formatter like this:
<mx:DateFormatter id="df" formatString="MM/DD/YYYY" />
Step 2:
In your Script block in the same .mxml file i.e., inside "<mx:Script> <![CDATA[ ........] </mx:Script", define the following function:
private function displayFormattedDate(d:Object,c:DataGridColumn):String {
var retval : String = "";
try {
retval = df.format(d[c.dataField]);
}catch (errObject:Error) { }
return retval;
}
Step 3:
Add this function to your column in data grid
ex:
<mx:DataGrid ....>
......
......
<mx:DataGridColumn dataField="itemDate" labelFunction="displayFormattedDate"/>
.....
.....
</mx:DataGrid>
Hope that helps.
Sudheer
Quote:
Originally Posted by nicetim
i need to do the same thing, except in my case, i am using components
A webserviceConnect, a DataSet and a DataGrid.
The date ends up in the grid with that extremly long formatting. I tried to change the components to format that field but it dosnt work.