easyUi的dataGrid格式化日期时间
更新:HHH   时间:2023-1-7


如果返回的时间格式是一长串数字,需要转换成日期时间格式,可使用以下方法:

{
     title: '发起时间',
     field: 'time',
     formatter : function(value, row, index) {
                    var date = new Date(value.time); 
                    var dateTime = date.toLocaleString(); 
                    dateTime = dateTime.replace(new RegExp("/", 'g'),"-");
                    return '<span title="'+dateTime+'">'+dateTime+'</span>';
    },
     width: 200
}
返回web开发教程...