在页面加一个 js 方法:
function toDate(v,r,i) {
var date = new Date();
date.setTime(v.time);
var y = date.getFullYear();
var m = date.getMonth()+1;
m = m<10?'0'+m:m;
var s = date.getSeconds();
var d = date.getDate();
d = d<10?("0"+d):d;
var h = date.getHours();
h = h<10?("0"+h):h;
var M = date.getMinutes();
M = M<10?("0"+M):M;
var S = date.getSeconds();
S = S<10?("0"+S):s;
var str = y+"-"+m+"-"+d+" "+h+":"+M+":"+S;
return str;
}
然后在数据表格列中的formatter属性=上面的方法,如:
<th field="aBuy_date" formatter="toDate" width="50" align="center">购入日期</th>