DateTime.php
public static function compare($date1, $date2): int
    {
        $d1 = static::create($date1);
        $d2 = static::create($date2);

        return ($d1 > $d2) ? static::DATETIME_GREATER : (($d1 < $d2) ? static::DATETIME_LESS : static::DATETIME_EQUAL);
    }
public static function compare($date1, $date2): int
    {
        $d1 = static::create($date1);
        $d2 = static::create($date2);

        return ($d1 > $d2) ? static::DATETIME_GREATER : (($d1 < $d2) ? static::DATETIME_LESS : static::DATETIME_EQUAL);
    }
public static function compare ( $ date1 , $ date2 ) : int { $ d1 = static :: create ( $ date1 ) ; $ d2 = static :: create ( $ date2 ) ; return ( $ d1 > $ d2 ) ? static :: DATETIME_GREATER : ( ( $ d1 < $ d2 ) ? static :: DATETIME_LESS : static :: DATETIME_EQUAL ) ; }
Return comparision result of 2 datetime object

@param $date1
@param $date2
@return integer
* 1  if Greater than
* 0  if Equal
* -1 if Less than
Return comparision result of 2 datetime object