java+request+date_关于SpringMVC+java+mysql的Date类型的时间问题

//获取mysql中的数据,其中包括时间

@RequestMapping("/getmanagers")

@ResponseBody

public List getWorkOrders(HttpServletRequest request){

List workOrders=workOrdersService.getWorkOrders();

request.setAttribute("workOrders", workOrders);

return workOrders;

}

------------------------------------------------------------------------------------------------------------

当获得数据时,后台debug可发现,获得的时间是一个13位的数字。这个就是java的时间戳

当运用到Extjs里的时候,要借用js的时间转换

columns: [{

text: 'ID',

dataIndex: 'id',

width:50,

editor: {

readOnly:true

}

}, {

// text: '故障时间',

header:'故障时间',

dataIndex: 'failuretime',

width:180,

renderer:function(value){

return new Date(parseInt(value)).toLocaleString();

}

}, {

text: '故障地点',

dataIndex: 'failureaddress',

width:200,

editor: {

allowBlank: false

}

}, {

header: '维修时间',

dataIndex: 'repairtime',

width:180,

// editor:new Ext.form.DateField({

// format:'Y-n-j',

// minValue:'1990-12-14'

// }),

renderer:

function(value){

return new Date(parseInt(value)).toLocaleString(); //13位时间戳转换为2013年10月11日 11:12:23格式

}

}, {

text: '维修人',

width:200,

dataIndex: 'maintenanceman',

editor:{

allowBlank:true

}

}, {

text: '完成情况',

width:100,

dataIndex: 'completion',

editor:{

allowBlank:true

}

}, {

text: '故障内容',

width:200,

dataIndex: 'failurecontent',

editor:{

allowBlank:true

}

}], 其中红色的部分为Extjs转换13位时间戳为日期的方法。这是我的笔记。下次忘了来看看

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值