Sometimes, we want to convert seconds into days, hours, minutes, and seconds with PHP.
In this article, we’ll look at how to convert seconds into days, hours, minutes, and seconds with PHP.
How to convert seconds into days, hours, minutes, and seconds with PHP?
To convert seconds into days, hours, minutes, and seconds with PHP, we use the gmdate
function.
For instance, we write
gmdate("d H:i:s", 1640467);
to call gmdate
with the format string that contains hours, minutes, and seconds and the number of seconds to convert to hours, minutes, and seconds.
Conclusion
To convert seconds into days, hours, minutes, and seconds with PHP, we use the gmdate
function.