2011-01-25 5 views

Répondre

2

J'ai trouvé cette ligne il y a longtemps, mais je ne sais pas d'où plus:

<?php 

function secondsToWords($seconds) 
{ 
    /*** return value ***/ 
    $ret = ""; 

    /*** get the hours ***/ 
    $hours = intval(intval($seconds)/3600); 
    if($hours > 0) 
    { 
     $ret .= "$hours hours "; 
    } 
    /*** get the minutes ***/ 
    $minutes = bcmod((intval($seconds)/60),60); 
    if($hours > 0 || $minutes > 0) 
    { 
     $ret .= "$minutes minutes "; 
    } 

    /*** get the seconds ***/ 
    $seconds = bcmod(intval($seconds),60); 
    $ret .= "$seconds seconds"; 

    return $ret; 
} 

echo secondsToWords(time()); 
?> 
1

Quelque chose comme cela devrait fonctionner:

printf("%d:%d:%d",$m/(1000*60*60), $m % (1000*60*60)/(1000*60),$m % (1000*60*60) % (1000*60)/1000); 
Questions connexes