DateTime::diff

PHP 5 >= 5.3.0, PHP 7, PHP 8
DateTime::diff - Returns the difference between two DateTime objects
Manual
Code Examples

Example #1 DateTime object comparison

Result: bool(false) bool(true) bool(false)
PHP Version:

Example #2 DateTime::diff example

Result: +2 days
PHP Version:


Function DateTime::diff:

Date and Time Functions

Most used PHP functions