标签:func box mat turn seconds tag min form idt
1、自定义一个日期转函数,如:
function formatDate(val) {
var year =
parseInt(val.year) + 1900;
var month =
(parseInt(val.month) + 1);
month =
month > 9 ? month : (‘0‘ + month);
var day =
parseInt(val.date);
day = day
> 9 ? day: (‘0‘ + day);
var hours =
parseInt(val.hours);
hours =
hours > 9 ? hours : (‘0‘ + hours);
var minutes
= parseInt(val.minutes);
minutes =
minutes > 9 ? minutes : (‘0‘ + minutes);
var seconds
= parseInt(val.seconds);
seconds =
seconds > 9 ? seconds : (‘0‘ + seconds);
var datetime
= year + ‘-‘ + month + ‘-‘ + date + ‘ ‘ + hours + ‘:‘ +
minutes
+ ‘:‘ +
seconds;
return
datetime;
}
2、在DateGrid控件的列中调用该函数:
columns
: [[ {
field :
‘birthday‘,
title :
‘生日‘,
width :
150,
align :
‘center‘,
formatter : function(value, row) {
return
formatDatebox(row.birthday);
}
}, {
field :
‘createTime‘,
title :
‘注册时间‘,
width :
150,
align :
‘center‘,
formatter : function(value, row) {
return
formatDatebox(row.createTime);
}
}, {
field :
‘department‘,
title :
‘部门‘,
width :
100,
align :
‘center‘,
formatter :
function(value, row) {
return
row.department.dname;
}
}
JQuery-EasyUI的DataGrid控件显示日期型数据
标签:func box mat turn seconds tag min form idt
原文地址:https://www.cnblogs.com/lone5wolf/p/10856092.html