I'm trying to compare two dates in PHP and figure out how many days apart the dates are. I am grabbing the first date from a MySQL database and the second date is the current date. The date in the MySQL database looks like this "2010-01-21 15:21:46"
$date1 = date("Y-m-d", $product['hold_date'])
$date2 = date("Y-m-d");
How can I compare these two dates and simply return the amount of days?
EDIT ---------------------------------------------------------------------------------
This works:
$date1 = date(strtotime('2009-12-25 15:21:46'));
$date2 = time();
$secondsDifference = $date2 - $date1;
$days = floor($secondsDifference / 86400);
echo $days;