Reputation:
I have this code and he calculate date diference and it's been good so far but I have problem, I want to subtract high number from lower and show value on negative and this code automatically find which number is higher I don't want that.
$to_time = strtotime("2012-10-25 10:42:00");
$from_time = strtotime("2012-10-26 10:21:00");
echo round(abs($to_time - $from_time) / 60,2). " minute";
Upvotes: 0
Views: 1904
Reputation: 2246
Try this
$to_time = strtotime("2012-10-25 10:42:00");
$from_time = strtotime("2012-10-26 10:21:00");
echo round(($to_time - $from_time)/60,2). " minute";
Upvotes: 0