PHP ManualDateTime::diffdate_diff(PHP 5 >= 5.3.0) DateTime::diff -- date_diff — Returns the difference between two DateTime objects DescriptionObject oriented style Procedural style Returns the difference between two DateTime objects. Parameters
Return Values
The DateInterval object representing the
difference between the two dates or ExamplesExample #1 DateTime::diff() example Object oriented style
<?php Procedural style
<?php The above examples will output: +2 days Example #2 DateTime object comparison
<?php The above example will output: bool(false) bool(true) bool(false) See Also
![]() |
PHP-Index
New Tutorial entries
|