I am encountering a crash when I try to compare a date that is in the database with the current date, it returns me to crash Call to a member function diff () on string in
I get the date of the database and when I give an echo it appears correct.
$dbDate = $this->Query->fetchColumn();
When I try to generate the current date for later comparison it generates the failure.
$aDate = date('Y-m-d H:i:s');
The fault log generated on the server points to the line below when it tries to check the fault.
$timePassed = $dbDate->diff($aDate);
I need to know how many minutes have passed since the date in the database.
$minutes = $timePassed->days * 24 * 60;
$minutes += $timePassed->h * 60;
$minutes += $timePassed->i;