1 Reply Latest reply on Jan 31, 2007 4:15 PM by BLXWebMaster

    date format in grid column

    rossrogerb
      Hello,

      I have a date field in a grid.
      what is the correct syntax to get it to display MM/DD/YYYY
      right now it displays as Wed Jan 30 00:00:00 GMT

      I have <mx:DateFormatter id="df" formatString="MM/DD/YYYY"/>
      as my date format and I added the syntax to the datafield
      dataField="{df.format(entrydate)}"

      But this just gives me an error.

      I found how to do it on a label but I need it formated in a grid column..

      Thank you

      Roger
        • 1. Re: date format in grid column
          BLXWebMaster Level 1
          There are several wasy to handle this, I primarily use a function and the labelFunction.

          <mx:Script>
          <![CDATA[
          //Formatter Functions
          public function formatDate(item:Object,column:DataGridColumn):String {
          return df.format(item[column.dataField]);}
          ]]>
          </mx:Script>

          <mx:DateFormatter id="df" formatString="MM/DD/YYYY"/>

          Then in your grid..
          <mx:DataGridColumn labelFunction="formatDate" headerText="Entry Date" dataField="ts_entrydate"/>

          That should get you what you are looking for.

          Allen