title: PHP — Convert milliseconds to Hours : Minutes : Seconds.fractional
body: <p>I've got a script that takes in a value in seconds (to 2 decimal points of fractional seconds):</p>
  
  <pre><code>$seconds_input = 23.75
  </code></pre>
  
  <p>I then convert it to milliseconds:</p>
  
  <pre><code>$milliseconds = $seconds_input * 1000; // --&gt; 23750
  </code></pre>
  
  <p>And then I want to format it like so:</p>
  
  <pre><code>H:M:S.x // --&gt; 0:0:23.75
  </code></pre>
  
  <p>Where 'x' is the fraction of the second (however many places after the decimal there are).</p>
  
  <p>Any help? I can't seem to wrap my mind around this. I tried using gmdate() but it kept lopping off the fractional seconds.</p>
  
  <p>Thanks.</p>