您的位置:首页 > 其它

Ext.Net_Ext.Net.DateColumn 日期格式问题

2011-07-19 14:36 309 查看
在使用DateColumn 时,会用到日期格式,代码如下:

<ext:DateColumn Header="日期" DataIndex="FINSERTEDDATE"Format="Y-m-d H:i:s"></ext:DateColumn>
那么EXT.NET日期格式是什么?之前以为跟数据库的格式差不多,又在EXT.NET CHM文档中找,都不对,其实,EXT.NET源代码就是最好的文档。

EXT.NET源代码片段

d:"String.leftPad(this.getDate(), 2, '0')",
D:"Date.getShortDayName(this.getDay())",
j:"this.getDate()",
l:"Date.dayNames[this.getDay()]",
N:"(this.getDay() ? this.getDay() : 7)",
S:"this.getSuffix()",
w:"this.getDay()",
z:"this.getDayOfYear()",
W:"String.leftPad(this.getWeekOfYear(), 2, '0')",
F:"Date.monthNames[this.getMonth()]",
m:"String.leftPad(this.getMonth() + 1, 2, '0')",
M:"Date.getShortMonthName(this.getMonth())",
n:"(this.getMonth() + 1)",
t:"this.getDaysInMonth()",
L:"(this.isLeapYear() ? 1 : 0)",
o:"(this.getFullYear() + (this.getWeekOfYear() == 1 &&this.getMonth() > 0 ? +1 : (this.getWeekOfYear() >= 52 &&this.getMonth() < 11 ? -1 : 0)))",
Y:"String.leftPad(this.getFullYear(), 4, '0')",
y:"('' + this.getFullYear()).substring(2, 4)",
a:"(this.getHours() < 12 ? 'am' : 'pm')",
A:"(this.getHours() < 12 ? 'AM' : 'PM')",
g:"((this.getHours() % 12) ? this.getHours() % 12 : 12)",
G:"this.getHours()",
h:"String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2,'0')",
H:"String.leftPad(this.getHours(), 2, '0')",
i:"String.leftPad(this.getMinutes(), 2, '0')",
s:"String.leftPad(this.getSeconds(), 2, '0')",
u:"String.leftPad(this.getMilliseconds(), 3, '0')",
O:"this.getGMTOffset()",
P:"this.getGMTOffset(true)",
T:"this.getTimezone()",
Z:"(this.getTimezoneOffset() * -60)",

说明

根据它们的函数名能猜到它们的含义。比如,Y和y表示年;M和m表示月;D和d表示天;H和h表示小时;i表示分;s和u表示秒;A和a表示上下午。其他的如,L表示是否为闰年;O和P表示格林威治标准时间(GMT),英国的标准时间,也是世界各地时间的参考标准。中英两国的标准时差为8个小时,即英国当地时间比中国北京时间晚8小时;T和Z表示协调世界时(UTC)等等。

以2011-07-14 14:05:37为例

格式
结果
Y-m-d H:i:s2011-07-14 14:05:37
y-m-d H:i:s
11-07-14 14:05:37
y-M-d H:i:s
2011-7-14 14:05:37
y-m-d H:i:s L
2011-7-14 14:05:37 0
y-m-d H:i:s T
2011-7-14 14:05:37 UTC
y-m-d H:i:s Z
2011-7-14 14:05:37 28800
y-m-d H:i:s O
2011-7-14 14:05:37 +0800
y-m-d H:i:s P
2011-7-14 14:05:37 +08:00
Y-m-d h:i:s
2011-07-14 2:05:37
Y-m-d H:i:s G
2011-7-14 14:05:37 14
Y-m-d H:i:s a
2011-7-14 14:05:37 下午
Y/m/d H:i:s
2011/07/14 14:05:37
Y/m/dH:i:s
2011/07/1414:05:37

说明

只要字母写对了,字母与字母间的字符无所谓,EXT.NET会原样显示。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: