PDA

View Full Version : Timestamp Formating Questing



Bleak
15 Sep 2010, 7:58 AM
I have a timestamp represented in json as



"timestamp": "2010-09-15 09:47:25.421",
I want to display this value in a grid as part of a datecolumn, which I have defined as



{
xtype : 'datecolumn',
dataIndex : 'timestamp',
header : 'Date',
sortable : true,
width : 100,
format : 'Y-m-d G:i:s'
}
The Reader on the JSON Store is configured as



new Ext.data.Record.create(
[
{name: 'id'},
{name: 'action_id'},
{name: 'user_id'},
{name: 'timestamp', type :'timestamp', dateFormat: 'Y-m-d G:i:s.u'},
{name: 'description'},
{name: 'username'}
]
)
The problem is that the for some reason the value always shows up as Nan-Nan-Nan NaN:NaN:NaN which I know means Not a Number..

Anyone know what is causing this? The format of the reader is set to what is returned from the database, and I understand this format to be the format I want it to be displayed in. I know it is the same as the value, but I will look to change this to a more readable format once I get the format working.

StuartAshworth
15 Sep 2010, 11:08 AM
"Timestamp" isn't a valid type for a field so consider using "date" instead.

Bleak
15 Sep 2010, 11:59 AM
Thanks Stoot... I can't believe it was that simple.