function GetSecondTimeFomate(a) {
if (a<3600){
let h = (parseInt(a / 3600));
if (h.toString().length == 1) {
h = "0" + h;
}
let m = (parseInt((a % 3600) / 60));
if (m.toString().length == 1) {
m = "0" + m;
}
let s = (a - 3600 * h - 60 * m);
if (s.toString().length == 1) {
s = "0" + s;
}
return (m + ":" + s)
}else {
let h = (parseInt(a / 3600));
if (h.toString().length == 1) {
h = "0" + h;
}
let m = (parseInt((a % 3600) / 60));
if (m.toString().length == 1) {
m = "0" + m;
}
let s = (a - 3600 * h - 60 * m);
if (s.toString().length == 1) {
s = "0" + s;
}
return (h + ":" + m + ":" + s)
}
}
// 格式化播放时间
export const getSecondTimeFomate = (time, isShowHour = false) => {
time = Math.ceil(time);
const h = (parseInt(time / 3600, 10)).toString().padStart(2, '0');
const m = (parseInt((time % 3600) / 60, 10)).toString().padStart(2, '0');
const s = (time - 3600 * h - 60 * m).toString().padStart(2, '0');
return isShowHour || time >= 3600 ? (h + ':' + m + ':' + s) : (m + ':' + s);
};
网友评论