<script>
var anHour = 60*60*1000;
function getNbengTime(costs,nbeng) {
var hours = costs / (nbeng * 3) ;
var fract = hours-parseInt(hours);
hours=parseInt(hours);
var milisecs = parseInt(anHour*fract)
var secs = parseInt(milisecs/1000);
var mins = parseInt(secs/60)
secs -= (mins*60)
if (mins<10) mins="0"+mins;
if (secs<10) secs="0"+secs;
return hours+':'+mins+':'+secs;
}
alert(getNbengTime(145,1))
</script>
|