noncom
noncom

Reputation: 4992

Filling DateField and TimeField, according to a format, with incoming data

I have a datefield and a timefield in my ExtJS form and I have to fill them with data sent from the server. The server sends data in the following format (via Ajax):

date=2013-05-10T00:00:00.000+04:00,time=1970-01-01T00:30:00.000+03:00

How do I get that displayed in the form fields formatted as Y/m/d and H:i respectively? I have tried various combinations but they do not work. The fields remain either blank or filled with the entire data value sent from the server.

UPDATE:

If it would make things easier, I can make the server send the values in a different format, say milliseconds...

Upvotes: 0

Views: 1086

Answers (1)

Hariharan
Hariharan

Reputation: 3263

The data which u send from backend is in "ISO 8601 date" format this has been supported by extjs. This needs to be resolve with help of Ext.Date.format class. Refer below link for your reference.

http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.Date

You need to add 'format' config to datafield and timefield and pass your format as string.

Thanks

Upvotes: 1

Related Questions