I would like to convert a variable $uptime which is seconds, into days, hours, minutes and seconds.
$uptime
Example:
Short, simple, reliable :
function secondsToDHMS($seconds) { $s = (int)$seconds; return sprintf('%d:%02d:%02d:%02d', $s/86400, $s/3600%24, $s/60%60, $s%60); }