I have today date stored in variable
$today=date(“Y-m-d”);
and other variable which is date fetched from mysql database.
$date2=(row[‘date2’]);
I have tried with date_diff:
$diff=$today-$date2;
But $today is string and i cant find out a solution.I have tried with
$today=newDateTime (date(“Y-m-d”));
And get an error: Object Of Class DateTime Could Not Be Converted To Int
Should mention that after i get the month i need to store them in a variable and multiply with other variable.
Any suggestions ?
Im guessing you want this:
example
returns -12, as that date was 12 months ago
Manual page: TIMESTAMPDIFF