Sencha 中的 Ext.Date.format()

Vik*_*ire 2 javascript extjs sencha-touch-2

我想要获取日期格式,如2017-04-20 00:00:00

目前我的代码是

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)
                });
            }
        }
    });
Run Code Online (Sandbox Code Playgroud)

需要更新Ext.Date.format(new Date(), "d-m-Y h:iA") 以获得我需要的日期格式。你有什么想法吗?

CD.*_*D.. 7

根据 的文档Ext.Date,您可以使用:

Ext.Date.format(new Date(), "Y-m-d h:i:s")
Run Code Online (Sandbox Code Playgroud)