0
I am finding a flaw when I try to compare a date that is in the database with the current date, returns me the fault Call to a Member Function diff() on string in
I take the date from the database and when I give an echo appears correct.
$dbDate = $this->Query->fetchColumn();
When I try to generate the current date for later comparison generates the failure.
$aDate = date('Y-m-d H:i:s');
The fault log generated on the server points to the line below when trying to check the defiance.
$timePassed = $dbDate->diff($aDate);
I need to know how many minutes have passed since the date it’s in the database.
$minutes = $timePassed->days * 24 * 60;
$minutes += $timePassed->h * 60;
$minutes += $timePassed->i;
By the looks of
$dbDate
probably a string. Something you can confirm by doingvar_dump($dbDate);
– Isac