title: Converting seconds to hours/minutes/seconds in PHP
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7127204/converting-seconds-to-hhmmss">Converting Seconds to HH:MM:SS</a>  </p>
  </blockquote>
  
  
  
  <p>I have an integer as a number of seconds. I want to convert that integer into into hours/minutes/seconds like this:</p>
  
  <pre><code>1:45:32
  </code></pre>
  
  <p>If the number of seconds equates to less than one hour then it should return the string:</p>
  
  <pre><code>45:32
  </code></pre>
  
  <p>If the number of minutes is less than 10 it should return the string formatted like this:</p>
  
  <pre><code>3:25
  </code></pre>
  
  <p>And finally if the number of seconds equate to less than 1 minute, it should return the following:</p>
  
  <pre><code>0:04
  </code></pre>
  
  <p>What is the best way to do this in PHP?</p>