no problem. here is an example:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; creationComplete="buildDP()">
<mx:Script>
<![CDATA[
var dp;
function buildDP(){
var item1:Object = new Object();
item1.name="jeff";
item1.dob = new Date(1970,11,17);
var item2:Object = new Object();
item2.name="lisa";
item2.dob = new Date(1968,7,23);
var item3:Object = new Object();
item3.name="kali";
item3.dob = new Date(2004,5,23);
dp = new Array(item1,item2,item3);
}
function formatDate(item:Object):String{
return formatter.format(item.dob);
}
]]>
</mx:Script>
<mx:DateFormatter id="formatter"/>
<mx:DataGrid dataProvider="{dp}">
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="name"/>
<mx:DataGridColumn columnName="dob" headerText="Date of Birth" labelFunction="formatDate"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:Application>


At 01:54 PM 2/28/2005, you wrote:

ok, but what happen if datetime I want to format is on a datagrid?

--- In [email protected], "Clint Tredway" <[EMAIL PROTECTED]> wrote:
> Here is a cell renderer that I use:
> <?xml version="1.0" encoding="iso-8859-1"?>
> <mx:Canvas xmlns:mx="<http://www.macromedia.com/2003/mxml>http://www.macromedia.com/2003/mxml";>
> <mx:Script>
> <![CDATA[
>
> function setValue(str:String, item:Object, sel:Boolean):Void {
> date_txt.text = StandardDateFormat.format(item.date);
> }
>
> ]]>
> </mx:Script>
> <!-- Declare a formatter and specify formatting properties. -->
> <mx:DateFormatter id="StandardDateFormat" formatString="M/DD/YYYY"/>
>
> <!-- Trigger the formatter while populating a string with data. -->
> <mx:Text id="date_txt"/>
>
> </mx:Canvas>
>
> Just change the formatString to how you want to format your date....
>
> -----Original Message-----
> From: Miguel Diaz Valenzuela [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 28, 2005 12:39 PM
> To: [email protected]
> Subject: [flexcoders] datetime format
>
>
>
>
> well, i�m again with another question to you coders
>
> i have a datetime row, with following format: 25/02/2005 12:57:00
>
> how can I format this one and change it in Macromedia Flex to this:
> 25/02/2005
>
> thanks in advance for all reply
>
>
>
>
>
>
> Yahoo! Groups Links





Yahoo! Groups Sponsor ADVERTISEMENT <http://us.ard.yahoo.com/SIG=129la1i5u/M=298184.6018725.7038619.3001176/D=groups/S=1705007207:HM/EXP=1109703288/A=2593423/R=0/SIG=11el9gslf/*http://www.netflix.com/Default?mqso=60190075> click here



----------
Yahoo! Groups Links
* To visit your group on the web, go to:
* <http://groups.yahoo.com/group/flexcoders/>http://groups.yahoo.com/group/flexcoders/


*
* To unsubscribe from this group, send an email to:
* <mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]


*
* Your use of Yahoo! Groups is subject to the <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.





Reply via email to