$date->compare()
Returns the interval between the provided and the object's datetime
$date->compare(DateTimeInterface|string|int $datetime = 'now', DateTimeZone|null $timezone = null): DateInterval
Parameters
Name | Type | Default | Description |
---|---|---|---|
$datetime | DateTimeInterface orstring orint |
'now'
|
|
$timezone | DateTimeZone ornull |
null
|
Optional default timezone if $datetime is string |
Return type
DateInterval
This method modifies the existing $date
object it is applied to and returns it again.