DateTime::diffDateTimeImmutable::diffDateTimeInterface::diffdate_diffReturns the difference between two DateTime objects BeschreibungObjektorientierter Stil
public DateInterval DateTime::diff
( DateTimeInterface
$datetime2
[, bool $absolute = false
] )
public DateInterval DateTimeImmutable::diff
( DateTimeInterface
$datetime2
[, bool $absolute = false
] )
public DateInterval DateTimeInterface::diff
( DateTimeInterface
$datetime2
[, bool $absolute = false
] )Prozeduraler Stil
DateInterval date_diff
( DateTimeInterface
$datetime1
, DateTimeInterface $datetime2
[, bool $absolute = false
] )Returns the difference between two DateTimeInterface objects. Parameter-Liste
Rückgabewerte
The DateInterval object representing the
difference between the two datesIm Fehlerfall wird BeispieleBeispiel #1 DateTime::diff example Objektorientierter Stil
<?phpProzeduraler Stil
<?phpDie obigen Bespiele erzeugen folgende Ausgabe: +2 days Beispiel #2 DateTime object comparison
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe: bool(false) bool(true) bool(false) Siehe auch
|