Wednesday, November 24, 2010

ExtJS dateformat

To render the date format of a date column within a grid, we will need to setup the fields for the grid correctly in the config.

field: [{name: 'fieldname'}, {name:'createdon', type='date', dateFormat=''}]
dateFormat options:
  • m/d/Y or Y-m-d H:i:s
  • timestamp: Unixtime
  • time: (TODO)
To render to your own date format on the grid:
columns: [ {id:'createdon',header: _("createdon"), width: 100, sortable: true, renderer: Ext.util.Format.dateRenderer('d M Y'), dataIndex: 'createdon'}

Reference on more dateformat:

No comments: