$date->compare()
Returns the interval between the provided and the object's datetime
$date->compare(DateTimeInterface|string|int $datetime = 'now', ?DateTimeZone $timezone = null): DateInterval
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| $datetime | DateTimeInterface|string|int |
'now' |
|
| $timezone | DateTimeZone|null |
null |
Optional default timezone if $datetime is string |
Return type
DateInterval