Search code examples
extjsdatefield

Couldn't get the date from DateField as expected in ExtJS


I tried to get value from datefield using Ext.getCmp('dateFieldId'). I expect it to be a string like 'dd-mm-yyyy'. But what I get is "Mon Feb 6 00:00:00 UTC......"

My code is

var effectivefromdate = new Ext.form.DateField({
    fieldLabel: 'XX',
    id:'XX',
    name: 'XX',
    format:'d/m/Y'
});

Plz help me on this, I'm Stuck:(


Solution

  • What you get from DateField component is a Date object. To get a string from it use Ext.Date.format(yourDateObject,'d-m-Y')