public static function factory($time = null, $timezone = null) {
        $timezone = static::timezone($timezone);

        if ($time instanceof DateTime) {
            return $time->setTimezone($timezone);
        }

        if (is_numeric($time)) {
            $time = '@' . $time;
        }

        $dt = new DateTime($time);
        $dt->setTimezone($timezone);

        return $dt;
    }
public static function factory($time = null, $timezone = null) {
        $timezone = static::timezone($timezone);

        if ($time instanceof DateTime) {
            return $time->setTimezone($timezone);
        }

        if (is_numeric($time)) {
            $time = '@' . $time;
        }

        $dt = new DateTime($time);
        $dt->setTimezone($timezone);

        return $dt;
    }
public static function factory ( $ time = null , $ timezone = null ) { $ timezone = static :: timezone ( $ timezone ) ; if ( $ time instanceof DateTime ) { return $ time -> setTimezone ( $ timezone ) ; } if ( is_numeric ( $ time ) ) { $ time = '@' . $ time ; } $ dt = new DateTime ( $ time ) ; $ dt -> setTimezone ( $ timezone ) ; return $ dt ; }
Return a DateTime object based on the current time and timezone.

@param string|int $time
@param string $timezone
@return \DateTime
Return a DateTime object based on the current time and timezone .