1

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?

Marc Audet
  • 46,011
  • 11
  • 63
  • 83
Toni
  • 670
  • 11
  • 29
  • I am not closing this since you are asking this specifically about Code Igniter, but consider http://stackoverflow.com/questions/676824/how-to-calculate-the-difference-between-two-dates-using-php?rq=1 and http://stackoverflow.com/questions/4504516/codeigniter-timespan-function?rq=1. – Gordon Aug 09 '13 at 16:58

1 Answers1

0

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;