I need to convert seconds to "Hour:Minute:Second".
For example: "685" converted to "00:11:25"
How can I achieve this?
Find the number of whole hours by dividing the number of seconds by 3,600. The number to the left of the decimal point is the number of whole hours. The number to the right of the decimal point is the number of partial hours.
As with Excel, the first step to converting elapsed second to time is to divide the value by 86400. To format the cells for mm:ss, select Format > Number > More Formats > More date and time formats from the Menu.
You can use the gmdate()
function:
echo gmdate("H:i:s", 685);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With