formatTime(value) {
let seconds = parseInt((value % (1000 * 60)) / 1000) // 秒数
let minutes = parseInt((value % (1000 * 60 * 60)) / (1000 * 60)) // 分钟数
let hours = parseInt((value % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)) // 小时数
let time = [hours, minutes, seconds]
// 补 0
time.forEach((el,index) => {
if(el < 10) {
time[index] = '0' + el
}
})
return time.join(':')
}
时间戳转时分秒格式
最新推荐文章于 2024-01-11 16:14:04 发布