标签:style blog color io for cti 代码 ar
EasyUI DataGrid 时间格式化
页面代码:
<table id="tbList" style="height: 340px;" striped="true" rownumbers="true" title="" iconcls="icon-edit" nowrap="false" checkbox="true" idfield="Id" url="@Url.Action("ListData")">
<tr>
<th field="Date" formatter="Common.DateFormatter" width="80">日期</th>
</tr>
</table>
js代码:
var Common = {
//EasyUI用DataGrid用日期格式化
TimeFormatter: function (value, rec, index) {
if (value == undefined) {
return "";
}
/*json格式时间转js时间格式*/
value = value.substr(1, value.length - 2);
var obj = eval(‘(‘ + "{Date: new " + value + "}" + ‘)‘);
var dateValue = obj["Date"];
if (dateValue.getFullYear() < 1900) {
return "";
}
var val = dateValue.format("yyyy-mm-dd HH:MM");
return val.substr(11, 5);
},
DateTimeFormatter: function (value, rec, index) {
if (value == undefined) {
return "";
}
/*json格式时间转js时间格式*/
value = value.substr(1, value.length - 2);
var obj = eval(‘(‘ + "{Date: new " + value + "}" + ‘)‘);
var dateValue = obj["Date"];
if (dateValue.getFullYear() < 1900) {
return "";
}
return dateValue.format("yyyy-mm-dd HH:MM");
},
//EasyUI用DataGrid用日期格式化
DateFormatter: function (value, rec, index) {
if (value == undefined) {
return "";
}
/*json格式时间转js时间格式*/
value = value.substr(1, value.length - 2);
var obj = eval(‘(‘ + "{Date: new " + value + "}" + ‘)‘);
var dateValue = obj["Date"];
if (dateValue.getFullYear() < 1900) {
return "";
}
return dateValue.format("yyyy-mm-dd");
}
};
EasyUI DataGrid 时间格式化,布布扣,bubuko.com
EasyUI DataGrid 时间格式化
标签:style blog color io for cti 代码 ar
原文地址:http://www.cnblogs.com/wolfocme110/p/3880047.html