DateTime::diff DateTimeImmutable::diff DateTimeInterface::diff date_diff Returns the difference between two DateTime objects &reftitle.description; &style.oop; public DateIntervalDateTime::diff DateTimeInterfacedatetime2 boolabsolutefalse public DateIntervalDateTimeImmutable::diff DateTimeInterfacedatetime2 boolabsolutefalse public DateIntervalDateTimeInterface::diff DateTimeInterfacedatetime2 boolabsolutefalse &style.procedural; DateIntervaldate_diff DateTimeInterfacedatetime1 DateTimeInterfacedatetime2 boolabsolutefalse Returns the difference between two DateTimeInterface objects. &reftitle.parameters; datetime The date to compare to. absolute Should the interval be forced to be positive? &reftitle.returnvalues; The DateInterval object representing the difference between the two dates&return.falseforfailure;. &reftitle.examples; <function>DateTime::diff</function> example &style.oop; diff($datetime2); echo $interval->format('%R%a days'); ?> ]]> &style.procedural; format('%R%a days'); ?> ]]> &examples.outputs; <classname>DateTime</classname> object comparison As of PHP 5.2.2, DateTime objects can be compared using comparison operators. $date2); ?> ]]> &example.outputs; &reftitle.seealso; DateInterval::format DateTime::add DateTime::sub