一、如果页面上显示时间的格式为2010-09-26,则sql查询时语句为:
select AutoID,Title,Keyword,Author,convert(char(10),Creattime,120) as Creattime from KMS_Document
同时extjs页面cm中应为:
{
dataIndex: 'Creattime',
header: '发布日期'
}
二、如果页面上显示时间的格式为2010/09/26,则sql查询时语句为:
select AutoID,Title,Keyword,Author,Creattime from KMS_Document
同时extjs页面cm中应为:
{
dataIndex: 'Creattime',
header: '发布日期',
renderer : function(value) {
if (value) {
var da = new Date(value.time)
return Ext.util.Format.date(da, ('Y/m/d'));
}
}
}
三、如果两者混用,即sql查询语句为:
select AutoID,Title,Keyword,Author,convert(char(10),Creattime,120) as Creattime from KMS_Document
而extjs页面为
{
dataIndex: 'Creattime',
header: '发布日期',
renderer : function(value) {
if (value) {
var da = new Date(value.time)
return Ext.util.Format.date(da, ('Y/m/d'));
}
}
}
则时间显示为“NaN/NaN/NaN”,不是想要的结果,即错误结果。