Vikas Hire
Vikas Hire

Reputation: 628

Ext.Date.format() in Sencha

I want to get date format like 2017-04-20 00:00:00

currently my code is

this.ToDatePicker = Ext.create('Ext.form.field.Text', {
        xtype: 'textfield',
        name: 'name',
        labelAlign: 'top',
        fieldLabel: 'Date Time',
        value: Ext.Date.format(new Date(), "d-m-Y h:iA"),
        listeners: {
            scope: this,
            afterrender: function (c) {
                c.getEl().on('click', function (e) {
                    console.log(e.target)
                    NewCssCal_DisableAfterToday(Ext.get(e.target).dom.id, 'ddmmyyyy', 'dropdown', true, 12)
                });
            }
        }
    });

need to update Ext.Date.format(new Date(), "d-m-Y h:iA") to get that date format as I needed. Can you have any idea to do that?

Upvotes: 2

Views: 17821

Answers (1)

CD..
CD..

Reputation: 74156

According to the documentation of Ext.Date, you can use:

Ext.Date.format(new Date(), "Y-m-d h:i:s")

Upvotes: 9

Related Questions