Extjs 4 dateField getValue [英] Extjs 4 dateField getValue

查看:102
本文介绍了Extjs 4 dateField getValue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

"toDate.getValue();"我觉得应该很简单,但仍然行不通.不返回Ext.date对象.我无法格式化日期.

I feel should be easy but still does not work, "toDate.getValue();" does not return Ext.date object. I cannot format date.

错误:格式未定义.

下面是我的表单字段.

var toDate = new Ext.form.DateField(
        {
            fieldLabel: "date"
            value: new Date(), name: "abs-to-date",
            width: 100,
            allowBlank: false
        }

提交表格后,我想格式化日期.

And on submission of form, i want to format date.

var toDateTime = toDate.getValue();
console.log(toDate.getValue());
toDateTime.setHours( toHour.getValue(), toMinute.getValue(), 0 );
abs.to = toDateTime.format( Date.patterns.JSONdateTime );   <---------------------

推荐答案

Extjs 4中有2种不同的日期类型.

There are 2 different date type in Extjs 4.

1)日期

2)续约日期

方法格式"可用于Ext.date,并且toDateTime是Date的对象. 以下是正确的语法.

method "format" is available to Ext.date and toDateTime is object of Date. following is right syntax.

abs.to = Ext.Date.format(toDateTime, Date.patterns.JSONdateTime );

这篇关于Extjs 4 dateField getValue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆