code: public function formatSeconds($elapsedTime)
      {
          $seconds = floor($elapsedTime);
          $output = array();
  
          //Hours (only if $seconds > 3600)
          if ($seconds > 3600) {
              $hours    = floor($seconds / 3600);
              $seconds  = $seconds - (3600 * $hours);
              $output[] = number_format($hours, 0);
          }
  
          //Minutes
          if ($seconds >= 60) {
              $minutes  = floor($seconds / 60);
              $seconds  = $seconds - ($minutes * 60);
              $output[] = str_pad((string) $minutes, 2, '0', STR_PAD_LEFT);
          }
          else {
              $output[] = '00';
          }
  
          //Seconds
          $output[] =($seconds > 0)
              ? str_pad((string) $seconds, 2, '0', STR_PAD_LEFT)
              : '00';
  
          return implode(':', $output);
      }
docs: Format Seconds into readable walltime (HH:ii:ss)
  
  @param float $elapsedTime
  @return string