PDA

View Full Version : datetime in displayfield



Unkind
15 Oct 2012, 5:52 AM
i have displayfield


{
xtype: 'displayfield',
fieldLabel: 'date',
name: 'DateWaitTo'
}

but on my form i see date like this
/Date(1314997200000)/

how i can render date to format dd.mm.yyyy?

sword-it
15 Oct 2012, 7:02 AM
Hi unkind,

For date formatting you can use dateRenderer() method of Ext.util.Format class. like-


{
xtype: 'displayfield',
fieldLabel: 'Name',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
value:new Date()
}


See here working sample example -http://jsfiddle.net/maneeshgo/NEPWz/2/
F (http://jsfiddle.net/maneeshgo/NEPWz/2/)or more detail read API docs - http://docs.sencha.com/ext-js/4-1/#!/api/Ext.util.Format-method-dateRenderer

Unkind
15 Oct 2012, 11:48 PM
this work only with value:new Date()
but on form load I have /Date(1314997200000)/