const dateCalculation = (second) => {
if (second > 0) {
let day = 0
let hour = 0
let minute = 0
let data = {}
minute = Math.floor(second / 60)
if (parseInt(minute) > 60) {
hour = parseInt(minute / 60)
minute %= 60 //算出有多分钟
}
if (parseInt(hour) > 24) {
day = parseInt(hour / 24)
hour %= 24 //算出有多小时
}
data.day = day
data.hour = hour
data.minute = minute
return `${data.day}:${data.hour}:${data.minute}`
}
}
JS把秒转为天时分
最新推荐文章于 2024-11-04 16:17:23 发布