How to convert a decimal into time, eg. HH:MM:SS
<p>I am trying to take a decimal and convert it so that I can echo it as hours, minutes, and seconds.</p>

<p>I have the hours and minutes, but am breaking my brain trying to find the seconds. Been googling for awhile with no luck. I'm sure it is quite simple, but nothing I have tried has worked. Any advice is appreciated!</p>

<p>Here is what I have:</p>

<pre><code>function convertTime($dec)
{
    $hour = floor($dec);
    $min = round(60*($dec - $hour));
}
</code></pre>

<p>Like I said, I get the hour and minute without issue. Just struggling to get seconds for some reason.</p>

<p>Thanks!</p>
