0

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...

noncom
  • 4,962
  • 3
  • 42
  • 70

1 Answers1

1

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

Hariharan
  • 3,191
  • 4
  • 19
  • 31
  • I'm having these "format" params in the configs which are defined exactly as I want. But them no work.. any more ideas? – noncom Jun 04 '13 at 11:50
  • 3
    you need to convert the "ISO 8601 date" to date format using javascript function. then assign thoe to the config. Please refer link for the conversion from existing request http://stackoverflow.com/questions/12498619/convert-iso-8601-time-date-into-plain-english – Hariharan Jun 04 '13 at 12:45