PDA

View Full Version : dateFormat



Jad
23 Mar 2012, 5:44 AM
Hello

I have a little problem I'm sure you fix it in a few minutes

I have a MySQL data base withe many tables, one have a datetime field
I use a data.model to read the db :


Ext.define('myModel', {
eextend: 'Ext.data.Model',
fields: [
{ name: 'id', type: 'int' },
{ name: 'creationDate', type: 'date', dateFormat:'c' },
...
],
proxy: {
type: 'service',
api : {
read : ...,
create : ...,
update : ...
}
}
});


My problem is

When I load this data.model the date is transformed in local mode
exemple
DB 2012-03-23 00:00:00
record loaded 2012-03-23 01:00:00

Thanks for all

mitchellsimoens
23 Mar 2012, 11:44 AM
var date = '2012-03-23 00:00:00';

date = Ext.Date.parse(date, 'c');

console.log(Ext.Date.format(date, 'Y-m-d H:i:s'));

Returns 2012-03-23 00:00:00 for me.