function timeMeter (t, type = 1) {
let time = Number(t);
let h = time / 3600 < 10 ? "0" + parseInt(time / 3600) : parseInt(time / 3600);
if (h != '00') time = time - h * 3600;
let m = time / 60 < 10 ? "0" + parseInt(time / 60) : parseInt(time / 60);
let s = time % 60 < 10 ? "0" + (time % 60) : time % 60;
if (type == 1) {
return h + ':' + m + ":" + s;
} else if (type == 2) {
return m + "分" + s + "秒";
}
}
js 秒转化为时间
最新推荐文章于 2024-06-25 12:55:55 发布