dataTable对某一列/两列进行格式转换
columnDefs:[
{
targets:[8,9],
"render": function (data,type){
if(type=="display"){
if(data) {
const time1 = new Date(parseInt(data));
const y = time1.getFullYear();
const m = time1.getMonth() + 1;
const d = time1.getDate();
const h = time1.getHours();
const mm = time1.getMinutes();
const s = time1.getSeconds();
function add0(m) {
return m < 10 ? '0' + m : m;
}
const time1_1 = y + '-' + add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s);
return time1_1;
}else {
return ' ';
}
}
return data;
}
}
],