Created
October 17, 2014 13:07
-
-
Save mvargasmoran/e4742691a575826f23d3 to your computer and use it in GitHub Desktop.
Seconds to human readable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function secondsToTime($seconds) { | |
$dtF = new DateTime("@0"); | |
$dtT = new DateTime("@$seconds"); | |
return $dtF->diff($dtT)->format('%a days, %h hours, %i minutes and %s seconds'); | |
} | |
echo secondsToTime(1640467); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment