Guest User

Untitled

a guest
Feb 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1.     class View_Helper_SecondConversion extends Zend_View_Helper_Abstract
  2.     {
  3.         public function SecondConversion($time)
  4.         {
  5.             if($time != -1)
  6.             {
  7.                 if($time >= 60)
  8.                 {
  9.                     $seconds = $time % 60;
  10.                     $time = ($time - $seconds) / 60;
  11.                     if($time >= 60)
  12.                     {
  13.                         $minutes = $time % 60;
  14.                         $time = ($time - $minutes) / 60;
  15.                         if($time >= 60)
  16.                         {
  17.                             $hours = $time % 60;
  18.                             $time = ($time - $hours) / 24;
  19.                             return $time." d ".$hours." h ".$minutes." m ".$seconds." s";
  20.                         }
  21.                         else {
  22.                             return $time." h ".$minutes." m ".$seconds." s";       
  23.                         }
  24.                     }  
  25.                     else {
  26.                         return $time." m ".$seconds." s";  
  27.                     }                      
  28.                 }  
  29.                 else {
  30.                     return $time." s"; 
  31.                 }
  32.             }
  33.             else {
  34.                 return "-";
  35.             }          
  36.         }  
  37.     }
Add Comment
Please, Sign In to add comment