秒数转成时分秒格式
2019-08-15 本文已影响0人
Rose_yang
formatDuring (seconds) {
let sec = seconds % 60;
let hours = Math.floor(seconds / 3600);
let minutes = Math.floor((seconds - hours * 3600) / 60);
sec = sec < 10 ? '0' + sec : sec;
minutes = minutes < 10 ? '0' + minutes : minutes;
hours = hours < 10 ? '0' + hours : hours;
return hours + ":" + minutes + ":" + sec;
},