当数据库里面用用时间戳(也就是毫秒数)来存储时间后,读取之后,转成json数据格式,存储在这种格式里面的值也还是 毫秒数的形式,在Ext页面所要显示的现在的日期格式,
在表格里面,可以通过renderer 渲染返回到页面用日期格式显示,
JSON格式:var json =[{createTime:'1234567676'}] ,createTime里面是时间戳。
{
header : "创建时间",
width : 80,
dataIndex : "createData",
id : "createData",
sortable : true,
renderer : function(value) {
// alert(value);
if (value == null || value == 0) {
return 'null'
} else {
//时间转好,将时间戳转换成Ext显示的日期格式
return Ext.util.Format.date(new Date(parseInt(value)),
'Y-m-d')
}
}
}]
在表格里面,可以通过renderer 渲染返回到页面用日期格式显示,
JSON格式:var json =[{createTime:'1234567676'}] ,createTime里面是时间戳。
在列模型里面可以这样子写。。
案例1:
columns: [
{text: "出生日期", width: 100, sortable: true, dataIndex: 'birthDate',renderer:function(value,row){return Ext.util.Format.data(new Data(parseINt(value)),
'Y-m-d')}},
{text: "入院时间", width: 100, sortable: true, dataIndex: 'inputDate',renderer:function(value,row){ return Ext.util.Format.date(new Date(parseInt(value)),
'Y-m-d')}},
]
案例2:
ColumnModle[{
header : "创建时间",
width : 80,
dataIndex : "createData",
id : "createData",
sortable : true,
renderer : function(value) {
// alert(value);
if (value == null || value == 0) {
return 'null'
} else {
//时间转好,将时间戳转换成Ext显示的日期格式
return Ext.util.Format.date(new Date(parseInt(value)),
'Y-m-d')
}
}
}]