db2中的timestamp转json,格式"time":{"date":8,"day":4,"hours":11,"minutes":0,"month":7,"nanos":140000000,"seconds":26,"time":1375930826140,"timezoneOffset":-480,"year":113}
到前台取出来就不对了,用了好多方法包括jstl都不行,
最后只能写脚本了
function timestamptodate(milliseconds){
var datetime = new Date();datetime.setTime(milliseconds);
var year=datetime.getFullYear();
//月份重0开始,所以要加1,当小于10月时,为了显示2位的月份,所以补0
var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
var hour = datetime.getHours()< 10 ? "0" + datetime.getHours() : datetime.getHours();
var minute = datetime.getMinutes()< 10 ? "0" + datetime.getMinutes() : datetime.getMinutes();
var second = datetime.getSeconds()< 10 ? "0" + datetime.getSeconds() : datetime.getSeconds();
return year + "-" + month + "-" + date+" "+hour+":"+minute+":"+second;
}