Показать сообщение отдельно

  #5  
Старый 29.01.2009, 23:49
Gifts
Reservists Of Antichat - Level 6
Регистрация: 25.04.2008
Сообщений: 827
С нами: 9497186

Репутация: 1304


По умолчанию

Mixon
PHP код:
function getDuration($s$l=0){
    if(
$s>86400){ // Day
        
$tot $s 86400;
        
$r $s 86400;
        if(
floor($tot)>1){$p='s';}else{$p='';}
        
$t floor($tot).' Day'.$p;
    }else if(
$s>3600){ // Hour
        
$tot $s 3600;
        
$r $s 3600;
        if(
floor($tot)>1){$p='s';}else{$p='';}
        
$t floor($tot).' Hour'.$p;
    }else if(
$s>60){ // Minute
        
$tot $s 60;
        
$r $s 60;
        if(
floor($tot)>1){$p='s';}else{$p='';}
        
$t floor($tot).' Minute'.$p;   
    }else{ 
// Second
        
if($s>1){$p='s';}else{$p='';}
        
$t $s.' Second'.$p;   
    }
    if(
$r 0){$t .= getDuration($r,$l+1);}
    if(
$l>0){
        return 
', '.$t;
    }
return 
$t;

 
Ответить с цитированием