Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
extJS或sencha中的日期-时间转换_Extjs - Fatal编程技术网

extJS或sencha中的日期-时间转换

extJS或sencha中的日期-时间转换,extjs,Extjs,你好,我想把2017年4月3日12:00转换成2017年12月1日12:00:00 如何在Ext Js中执行此操作 目前我的代码是: this.ToDatePicker = Ext.create('Ext.form.field.Text', { xtype: 'textfield', name: 'name', labelAlign: 'top', fieldLabel: 'Date Time', value: E

你好,我想把2017年4月3日12:00转换成2017年12月1日12:00:00 如何在Ext Js中执行此操作 目前我的代码是:

 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)
                });
            }
        }
    });

this.ToCalenderIcon = new Ext.Container({
        html: "<img class='calIcons' src='public/touchWorldCssJs/images/cal.gif'/>",
        scope: this,
        padding: '27 5 5 5',
        listeners: {
            scope: this,
            afterrender: function (c) {
                c.getEl().on('click', function (e) {
                    if (Ext.get(e.target).hasCls('calIcons')) {
                        console.log(Ext.get(e.target).dom.id);
                        NewCssCal_DisableAfterToday(me.ToDatePicker.inputEl.id, 'ddmmyyyy', 'dropdown', true, 12)
                    }
                });
            }
        }
    });

this.ToCalenderIcon在呈现此设置日期格式(如2017年4月3日12:00AM)后,因此我需要将其转换为2017年12月1日12:00:00

据我所知,JavaScript本机不支持AM/PM概念,因此您必须通过Ext.date根据指定格式进行解析

在toDatePicker中,将日期显式格式化为d-m-Y h:iA。 要将其转换为另一种格式,您需要首先解析它,因为JavaScript的原生日期无法解析结果字符串:

Ext.Date.format(Ext.Date.parse("03-04-2017 12:00AM", "d-m-Y h:iA"), "d-m-Y h:i:s")
我希望这就是你想要的。
如果你对如何使4月3日看起来像12月1日感兴趣,你应该首先写上12月1日。

我不明白你的问题。您想将今天的日期转换为2017-12-01 12:00:00格式或您提供的格式?