I have a page that shows the status of a TeamSpeak server on which I user ServerQuery to get the server's uptime using $uptime. This displays the server uptime as a total in seconds and I convert it to days, hours, minutes and seconds using
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');
I output the uptime in the above format using secondsToTime($uptime); but I would like for the output to count up from the original output once the page is loaded instead of having to refresh the page to get the new uptime.
Thanks in advance.