Monday, July 16, 2012

PHP Time Diff

How to calculate minute difference between two date-times in PHP?


Here is the answer:

$to_time = strtotime("2008-12-13 10:42:00");
$from_time = strtotime("2008-12-13 10:21:00");
echo round(abs($to_time - $from_time) / 60,2). " minute";

No comments:

Post a Comment