I want to convert seconds to hours in ExtJS and would like to know if there is a function similar to gmdate ("H: i: s", $ total) in PHP.
I want to convert seconds to hours in ExtJS and would like to know if there is a function similar to gmdate ("H: i: s", $ total) in PHP.
You can do a function in javascript. Something like:
function segundosParaHora(seg) {
var horas = Math.floor(seg/(60*60));
var resto = seg % (60*60);
var minutos = Math.floor(seg/60);
resto %= 60;
segundos = Math.ceil(resto);
var hora = {
"H": horas,
"i": minutos,
"s": segundos
};
return hora;
}
I used 60 * 60 for readability (60s in 1min and 60min in 1 hour), but you can put the 3600 with no problem.