private function getMysqlTimeZoneOffset(string $timezone): string
    {
        $tzUtc = new \DateTimeZone('UTC');
        $tLocal = new \DateTimeZone($timezone);
        $timeUtc = new \DateTime('now', $tzUtc);
        $offsetSeconds = $tLocal->getOffset($timeUtc);
        $offsetHours = $offsetSeconds / 3600;
        $offsetHours = ($offsetHours < 0) ? $offsetHours * -1 : $offsetHours;
        $prefix = ($offsetSeconds < 0) ? '-' : '+';
        return $prefix . sprintf('%02d:00', $offsetHours);
    }
private function getMysqlTimeZoneOffset(string $timezone): string
    {
        $tzUtc = new \DateTimeZone('UTC');
        $tLocal = new \DateTimeZone($timezone);
        $timeUtc = new \DateTime('now', $tzUtc);
        $offsetSeconds = $tLocal->getOffset($timeUtc);
        $offsetHours = $offsetSeconds / 3600;
        $offsetHours = ($offsetHours < 0) ? $offsetHours * -1 : $offsetHours;
        $prefix = ($offsetSeconds < 0) ? '-' : '+';
        return $prefix . sprintf('%02d:00', $offsetHours);
    }
private function getMysqlTimeZoneOffset ( string $ timezone ) : string { $ tzUtc = new \ DateTimeZone ( 'UTC' ) ; $ tLocal = new \ DateTimeZone ( $ timezone ) ; $ timeUtc = new \ DateTime ( 'now' , $ tzUtc ) ; $ offsetSeconds = $ tLocal -> getOffset ( $ timeUtc ) ; $ offsetHours = $ offsetSeconds / 3600 ; $ offsetHours = ( $ offsetHours < 0 ) ? $ offsetHours * - 1 : $ offsetHours ; $ prefix = ( $ offsetSeconds < 0 ) ? '-' : '+' ; return $ prefix . sprintf ( '%02d:00' , $ offsetHours ) ; }
Calculates offset between given timezone and UTC in mysql compatible format.

@param string $timezone
@return string
@throws \Exception
Calculates offset between given timezone and UTC in mysql compatible format .