View Full Version : dateFormat timestamp not working in v4?

23 Oct 2011, 6:09 AM
I know this used to work but seems to have stopped in v4. I am using v4.0.7

In my Model I set
{ name: 'createdDate', type: 'date', dateFormat:'timestamp' }

the json comes across like this
createdDate: 1280339104000

In the grid it looks like this Thu Apr 21 42507

I did get this to work

{ name: 'createdDate', type: 'int' }

and set the renderer to this
var dt = new Date(val);
return Ext.Date.format(dt, 'm-d-Y h:i a');

23 Oct 2011, 7:37 AM
This should work, but the provided value is multiplied by 1000 before converting it into a date. I think that's how you get the year in the far far future.

23 Oct 2011, 7:49 AM
The date is in milliseconds which should be standard isn't it?

The javascript date function seems to handle it correctly which is why it seems strange that Ext doesn't handle it well.

23 Oct 2011, 8:00 AM
I think you need to use dateFormat: 'time' in your case. That uses parseInt().

23 Oct 2011, 11:02 AM
That did. Thanks.