Please wait while we load your page...
 

Announcements

PHP Manual :: The DateTimeInterface interface



DateTimeImmutable::sub || DateTime::diff || Date/Time || PHP Manual

(PHP 5 >= 5.5.0, PHP 7)

DateTimeInterface is meant so that both DateTime and DateTimeImmutable can be type hinted for. It is not possible to implement this interface with userland classes.

DateTimeInterface {
/* Methods */
public DateInterval diff ( DateTimeInterface $datetime2 [, bool $absolute = false ] )
public string format ( string $format )
public int getOffset ( void )
public int getTimestamp ( void )
public DateTimeZone getTimezone ( void )
public __wakeup ( void )
}

Version Description
5.5.8 Trying to implement DateTimeInterface raises a fatal error now. Formerly implementing the interface didn't raise an error, but the behavior was erroneous.



DateTimeImmutable::sub || DateTime::diff || Date/Time || PHP Manual
Live Chat Not Available