formatTime({ cellValue, row, column }) {
// cellValue日期
let t = new Date(cellValue)
let format = 'yyyy-MM-dd HH:mm:ss'
let tf = function(i) {
return (i < 10 ? '0' : '') + i
}
return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function(a) {
switch (a) {
case 'yyyy':
return tf(t.getFullYear())
// break
case 'MM':
return tf(t.getMonth() + 1)
// break
case 'mm':
return tf(t.getMinutes())
// break
case 'dd':
return tf(t.getDate())
// break
case 'HH':
return tf(t.getHours())
// break
case 'ss':
return tf(t.getSeconds())
// break
}
})
}
日期格式化
最新推荐文章于 2023-06-15 18:43:21 发布