根据时间戳获取总用时(天时分秒)
//获取总用时(天时分秒)
export const getTotalTime = (time) => {
if (!time) {
return "";
}
let s = time / 1000;
let m = s / 60;
let h = m / 60;
let day = h / 24;
if (Math.floor(day)) {
return Math.floor(day) + "天" + Math.floor(h) % 24 + "时" + Math.floor(m) % 60 + "分";
} else if (!Math.floor(day) && (Math.floor(h) % 24 != 0)) {
return Math.floor(h) % 24 + "时" + Math.floor(m) % 60 + "分";
} else {
return Math.floor(m) % 60 + "分";
}
}