title: Convert seconds(float) into mm:ss:ms in php
body: <p>I have the below php function which takes a time argument in seconds from a database. The seconds are of type float(6,1) in the database. I then pass that value to the function below. The problem i have is if i have 1655.5 seconds i can get the hour, minutes and seconds. But how do i get the milliseconds that remain.</p>
  
  <p>ie 1655.5 = 27m:35s.5ms   </p>
  
  <p>Thanks for any help in advance.</p>
  
  <pre><code>&lt;?php
      function convertTo($init)
      {
            $hours = ($init / 3600);
            $minutes = (($init / 60) % 60);
            $seconds = $init % 60;
  
              if($minutes &lt; 10)
              {
                  $minutes = "0".$minutes;
              }
  
              if($seconds &lt; 10)
              {
                  $seconds = "0".$seconds;
              }
  
            $milli = /* code to ret the remaining milliseconds */   
            $stageTime = "$minutes:$seconds.$milli";
            return $stageTime;
      }
  
  ?&gt;
  </code></pre>