Unfortunately I cannot use DateTime::Diff
and am looking for a way to convert my current format of datetime so I may subtract and find the difference in hours and minutes, something like this:
// 2:11pm 2-20-2012
$opendate = '2012-02-20T14:11:03-05:00';
// 6:22pm 2-20-2012
$closedate = '2012-02-20T18:22:50-05:00';
$diff_date = $closedate - $opendate
I would like $diff_date
to return in hours::minutes format, such as '4 hrs 11 min'.
If it would be beneficial for this, another alternative to the times formatted above is:
$removeT = "T";
$replaceSPACE = " ";
//returns datetime like '2012-02-20 14:11:03'
$r = str_replace($removeT, $replaceSPACE, $opendate[$i]);
$r = substr($r, 0, 19);
//returns datetime like '2012-02-20 18:22:50'
$s = str_replace($removeT, $replaceSPACE, $closedate[$i]);
$s = substr($s, 0, 19);