4

如何从所有浏览器支持的 extjs 4.0 中的日期字段中仅获取02/8/2013 mm/dd/yyyy之类的日期。

我的代码如下

   items: [{                  
                xtype: 'datefield',
                fieldLabel: 'Date',
                format: 'm/d/Y',
                altFormats: 'm/d/Y',

            },

我从这个字段中得到一个像这样的值

date = Ext.getCmp('configuration-section-contact-form-date-of-issue').getValue();

通过使用上面的行,我得到了完整的 UTC 时间,但我只想要像 02/8/2013 这样的日期。我怎样才能得到请帮助我。谢谢..

4

4 回答 4

7

您可以使用:

dateField.getSubmitValue();

查看jsfiddle上的实时示例

于 2013-02-14T11:24:14.190 回答
1

试试这个:

Ext.getCmp('configuration-section-contact-form-date-of-issue').getValue().format('m/d/Y');
于 2013-02-14T11:18:30.667 回答
0

您可以使用“Ext.util.Format.Date”方法将日期格式化为所需格式。

Ext.util.Format.Date(Ext.getCmp('configuration-section-contact-form-date-of-issue').getValue(),'m/d/Y')
于 2013-02-14T11:19:42.347 回答
0

我今天遇到了这个问题,我使用了这种方式并且它有效:

var searchText = Ext.util.Format.date(Ext.getCmp('pes1').getValue(), 'd/m/Y');
于 2016-01-19T11:26:32.890 回答