PDA

View Full Version : How to convert date format from "dd/mm/yyyy" to "d/m/Y" (ExtJs format)



kamalraj
3 Apr 2012, 12:13 AM
Hi All,

I am trying to create a ExtJs "datefield" using user's input, all are well and good, except the format given by the user.

User will give the JS format string like "dd/mm/yyyy" which will reflect change of format if applied directly to "format" attribute in "datefield".

Since "dd/mm/yyyy" will return "0606/0404/12121212" for "06/04/2012" which is "d/m/Y".

Is there any method available in Ext, to convert the format string.

Thanks.

mitchellsimoens
3 Apr 2012, 8:14 AM
You can only have one format to display but you can use altFormats config to accept different input formats that a user can type

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.Date-cfg-altFormats

mitchellsimoens
3 Apr 2012, 8:15 AM
Moved to Ext JS 4 Q&A forum.