bootstrap中columns格式化日期格式
bootstrap渲染表格页面
{
field: 'time',
title: '时间',
formatter: function (value, row, index) {
return changeDateFormat(row.time);
}
}
js实现changeDateFormat方法并且格式化日期格式
function changeDateFormat(cellval) {
console.log(cellval);
if (cellval != null){
var date = new Date(cellval);
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
return date.getFullYear() + "-" + month + "-" + currentDate;
}
}