On converting the given time in seconds you have to follow the calculation in days and hours etc. Using PHP you can get the format by using the code below:-
Here I created the function ConvertToSec ($sec) as param:
function ConvertToSec($sec) {
$DateTime = new DateTime("@0");
$DateTimeNew = new DateTime("@$sec");
return $DateTime->diff($DateTimeNew)->format('%a days, %h hours, %i minutes and %s seconds');
}
Lets pass the seconds in function
echo ConvertToSec(1642359)
Output:-
19 days, 0 hours, 12 minutes and 39 seconds
And it workd perfect for me.
0 Comment(s)