extjs datafield 格式化
时间:2014-08-06 12:04:31
收藏:0
阅读:360
extjs DateField 的值用getValue()方法获取后是一大堆字符串,类似Tue Dec 07 2010 00:00:00 GMT 0800,这玩意存入数据库实在不好办。。。所以要把它格式化一下,方法很简单,用EXT的
示例:
var gedt = Ext.util.Format.date(日期控件.getValue(), ‘Y-m-d‘);
Ext.util.Format.date()方法
示例:
var gedt = Ext.util.Format.date(日期控件.getValue(), ‘Y-m-d‘);
出来的日期格式就是2010-10-10这样的
//
Formats the passed date using the specified format pattern.
Parameters
- value : String/Date
The value to format. If a string is passed, it is converted to a Date by the Javascript‘s built-in Date.parse method.
- format : String (optional)
Any valid date format string. Defaults to Ext.Date.defaultFormat.
评论(0)