I would like to return the number of days between NOW and some datetime using DateTime object. My dates are:
$now = "2018-03-08 14:00:00";
$last = "2018-02-06 20:00:00";
And I do it like this:
$now = new DateTime();
$last_dt = new DateTime($last);
$difference = $last_dt->diff($now);
$difference->format('%d');
$num_of_days = $difference->d;
For some weird reason, the value of $num_of_days is 1 (instead of like 30)
Anybody knows why please?
Thank you