PHP 5.4.37 Released

La interfaz DateTimeInterface

(PHP 5 >= 5.5.0)


Sinopsis de la Clase

DateTimeInterface {
/* Métodos */
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 )

Tabla de contenidos

add a note add a note

User Contributed Notes 1 note

2 months ago
It should be noted that you cannot implement this interface yourself, you'll get a fatal error (apparently by design). Instead, this interface is (currently) only useful for type checking or type hinting to allow either DateTime or DateTimeImmutable.

function someFunction(DateTimeInterface $date){
    //$date could be either DateTime or DateTimeImmutable
To Top