ext datefield timefield and format

DateField TimeField 日期控件 时间控件 日历控件
在extjs中,自带了两个与时间有关的控件,
html:
<div id='dp' style='width: 120px; height: 30px;'<>/div>
js:
//日期格式参考extjs api文档的Date类型, 参考下面的FormPanel
var md = new Ext.form.DateField({
    fieldLabel: 'Register Date',
    name: 'register_date',
    width: 190,
    allowBlank: false, // 设置非空,
    altFormats: 'Y-m-d H:i:s',
    format: 'Y-m-d H:i:s',
    blankText: 'rrr ...', //如为空,后面会出现一个I的图标,点击后出现的alt内容
    emptyText: 'Select a date ...' //如为空,直接在input中出现的text,有红色边框
});
md.render('dp'); // 在div中显示
// 这是是用DateField做例子,TimeField 也是差不多的.

再看看Ext.Date的格式说明
    d 01 to 31
    D Mon to Sun
    j 1 to 31
    l Sunday to Saturday
    N 1 (for Monday) through 7 (for Sunday)
    S st, nd, rd or th. Works well with j
    w 0 (for Sunday) to 6 (for Saturday)
    z 0 to 364 (365 in leap years)
    W 01 to 53
    F January to December
    m 01 to 12
    M Jan to Dec
    n 1 to 12
    t 28 to 31
    L 1 if it is a leap year, 0 otherwise.
    o Examples: 1998 or 2004
    Y Examples: 1999 or 2003
    y Examples: 99 or 03
    a am or pm
    A AM or PM
    g 1 to 12
    G 0 to 23
    h 01 to 12
    H 00 to 23
    i 00 to 59
    s 00 to 59
    u 001 to 999
    O Example: +1030
    P Example: -08:00
    T Examples: EST, MDT, PDT ...
    Z -43200 to 50400
    c 2007-04-17T15:19:21+08:00
    U 1193432466 or -2138434463

你可能感兴趣的:(C++,c,ext,J#,sun)