1、先创建一个js文件,复制以下内容保存:
function parseToDate(value) {
if (value == null || value == '') {
return undefined;
}
var dt;
if (value instanceof Date) {
dt = value;
} else {
if (!isNaN(value)) {
dt = new Date(value);
} else if (value.indexOf('/Date') > -1) {
value = value.replace(/\/Date\((-?\d+)\)\//, '$1');
dt = new Date();
dt.setTime(value);
} else if (value.indexOf('/') > -1) {
dt = new Date(Date.parse(value.replace(/-/g, '/')));
} else {
dt = new Date(value);
}
}
return dt;
}
// 为Date类型拓展一个format方法,用于格式化日期
Date.prototype.format = function(format) // author: meizz
{
var o = {
"M+" : this.getMonth() + 1, // month
"d+" : this.getDate(), // day
"h+" : thi

这篇博客主要介绍了在使用easyUI的datagrid时遇到的时间类型转换问题的解决方法。通过创建一个JavaScript文件并引入,实现了对时间数据的正确显示。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



