protected function getOffsetFromUtc(string $zone)
    {
        $zone   = str_replace(['GMT','UTC'], '', $zone);
        $zone   = str_replace(':', '', $zone);

        $add    = $zone[0] == '+';
        $zone   = substr($zone, 1);

        switch (strlen($zone)) {
            case 1:
            case 2:
                return $zone * 3600 * ($add?1:-1);
            case 3:
                $hour   = substr($zone, 0, 1) * 3600;
                $minute = substr($zone, 1) * 60;
                return ($hour+$minute) * ($add?1:-1);
            case 4:
                $hour   = substr($zone, 0, 2) * 3600;
                $minute = substr($zone, 2) * 60;
                return ($hour+$minute) * ($add?1:-1);
        }

        return 0;
    }
protected function getOffsetFromUtc(string $zone)
    {
        $zone   = str_replace(['GMT','UTC'], '', $zone);
        $zone   = str_replace(':', '', $zone);

        $add    = $zone[0] == '+';
        $zone   = substr($zone, 1);

        switch (strlen($zone)) {
            case 1:
            case 2:
                return $zone * 3600 * ($add?1:-1);
            case 3:
                $hour   = substr($zone, 0, 1) * 3600;
                $minute = substr($zone, 1) * 60;
                return ($hour+$minute) * ($add?1:-1);
            case 4:
                $hour   = substr($zone, 0, 2) * 3600;
                $minute = substr($zone, 2) * 60;
                return ($hour+$minute) * ($add?1:-1);
        }

        return 0;
    }
protected function getOffsetFromUtc ( string $ zone ) { $ zone = str_replace ( [ 'GMT' , 'UTC' ] , '' , $ zone ) ; $ zone = str_replace ( ':' , '' , $ zone ) ; $ add = $ zone [ 0 ] == '+' ; $ zone = substr ( $ zone , 1 ) ; switch ( strlen ( $ zone ) ) { case 1 : case 2 : return $ zone * 3600 * ( $ add ? 1 : - 1 ) ; case 3 : $ hour = substr ( $ zone , 0 , 1 ) * 3600 ; $ minute = substr ( $ zone , 1 ) * 60 ; return ( $ hour + $ minute ) * ( $ add ? 1 : - 1 ) ; case 4 : $ hour = substr ( $ zone , 0 , 2 ) * 3600 ; $ minute = substr ( $ zone , 2 ) * 60 ; return ( $ hour + $ minute ) * ( $ add ? 1 : - 1 ) ; } return 0 ; }
returns the offset based on UTC

@param *string $zone The timezone to calculate the offset with

@return string|int
returns the offset based on UTC