标签:bre ret display duration ati 时长 val var style
function getDuration(value,dateFormat){
let hour = parseInt((value) / 3600);
if (hour<10) {//时
hour = "0" + hour;
}
var minute = parseInt((value % 3600) / 60);
if (minute<10) {//分
minute = "0" + minute;
}
var second = Math.ceil(value % 60);
if (second<10) {//秒
second = "0" + second;
}
switch (dateFormat) {
case ‘hh:mm‘:
return hour + ":" + minute;
break;
case ‘mm:ss‘:
return minute + ":" + second;
break;
case ‘hh‘:
return hour;
break;
default:
return hour + ":" + minute + ":" + second;
break;
}
标签:bre ret display duration ati 时长 val var style
原文地址:https://www.cnblogs.com/czf1987/p/14633401.html