Question

I am working on a project that needs to check time difference between a particular time in the past and now, and to output the diff in MINUTES only. Example if the Diff is 2hour 3min. the output should be 123 (ie 2hr(120 minutes) + 3min).

I used CodeIgniter timespan() function, but it only returns something like 2hours 3minutes. Is there a way I can get the required output?

Was it helpful?

Solution

Do you need something like this ?

$tomorrow  = mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"));
$today = mktime(0, 0, 0, date("m"), date("d"),   date("Y"));

$minutesDiff = ($tomorrow - $today)/60;
echo $minutesDiff;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top