Convert seconds to hours:minutes:seconds
P粉752290033
P粉752290033 2024-03-25 16:29:26
0
2
616

I need to convert seconds to "hour:minute:second".

For example: "685" is converted to "00:11:25"

How can I achieve this goal?

P粉752290033
P粉752290033

reply all(2)
P粉799885311

An hour is 3600 seconds and a minute is 60 seconds, why not:

produce:

$ php file.php
0:11:25

(I didn't test this much, so there may be errors with floors etc.)

P粉301523298

You can use gmdate() function:

echo gmdate("H:i:s", 685);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template