I runned into few examples where people share code for calculating the difference between two days.
Eg.
$now = new DateTime();
$itemDate->diff($n
r - Sign "-" when the difference is negative, empty when positive a - Total number of days as a result of a DateTime::diff() or (unknown) otherwise.
As an example,
<?php
$now = new DateTime();
$d = new DateTime('2019-01-01T15:03:01.012345Z');
$x = $d->diff($now)->format("%r%a");
echo $x;
?>
Output: string(4) "-287"
When doing difference between DateTimeInterface
objects, DateInterval
object will be returned. You don't have DateTime's anymore, you have interval, and intervals are formatted different as DateTime objects. Format is explained here: http://php.net/manual/en/dateinterval.format.php