function getHumanTime($seconds) {
$sign = '';
if($seconds < 0) {
$sign = '-';
$seconds = -$seconds;
}
$hours = floor($seconds / 3600);
$seconds -= 3600 * $hours;
$minutes = floor($seconds / 60);
$seconds -= 60 * $minutes;
return $sign . $hours . ':'
. (($minutes < 10)? '0' : '') . $minutes . ':'
. (($seconds < 10)? '0' : '') . (int) $seconds;
}
const formatTime = seconds => [
seconds / 3600 | 0,
seconds / 60 % 60 | 0,
seconds % 60,
].map(n => `${n}`.padStart(2, 0)).join(':');
function secToTime(num) {
num = Number(num);
var h = Math.floor(num / 3600);
var m = Math.floor(num % 3600 / 60);
var s = Math.floor(num % 3600 % 60);
h = (h < 10 ? '0' : '') + h;
m = (m < 10 ? '0' : '') + m;
s = (s < 10 ? '0' : '') + s;
return h + ':' + m + ':' + s;
}
alert(secToTime(70));