I need to compare elapsed time. Was thinking bellow would do it until I had a elapsed time of more than 25 hours, then it reverts to a negative integer.
Is there a better approach for elapsed time for the likes of 135:00:00?
strtotime('24:59:59') - strtotime('TODAY') = 89999
strtotime('25:00:00') - strtotime('TODAY') = -1659481200
>Solution :
Since you have your time like that you cant use strtotime since it needs a valid timestamp, another approach would be this:
<?php
$time = "24:59:59";
$pieces = explode(":", $time);
$seconds = 0;
$seconds += $pieces[0] * 3600;
$seconds += $pieces[1] * 60;
$seconds += $pieces[2];
echo $seconds;