src/AnalyticsTrait.php
public function getTimezoneHourOffset($origin_tz = 'UTC', $format = 'h') {
        $remote_tz = 'UTC';
        if ($origin_tz === 'UTC') {
            return 0 . 'h';
        }
        $origin_dtz = new \DateTimeZone($origin_tz);
        $remote_dtz = new \DateTimeZone($remote_tz);
        $origin_dt = new \DateTime("now", $origin_dtz);
        $remote_dt = new \DateTime("now", $remote_dtz);

        $offset =  $remote_dtz->getOffset($remote_dt) - $origin_dtz->getOffset($origin_dt);
        return $offset / 3600 . $format;
    }
public function getTimezoneHourOffset($origin_tz = 'UTC', $format = 'h') {
        $remote_tz = 'UTC';
        if ($origin_tz === 'UTC') {
            return 0 . 'h';
        }
        $origin_dtz = new \DateTimeZone($origin_tz);
        $remote_dtz = new \DateTimeZone($remote_tz);
        $origin_dt = new \DateTime("now", $origin_dtz);
        $remote_dt = new \DateTime("now", $remote_dtz);

        $offset =  $remote_dtz->getOffset($remote_dt) - $origin_dtz->getOffset($origin_dt);
        return $offset / 3600 . $format;
    }
public function getTimezoneHourOffset ( $ origin_tz = 'UTC' , $ format = 'h' ) { $ remote_tz = 'UTC' ; if ( $ origin_tz === 'UTC' ) { return 0 . 'h' ; } $ origin_dtz = new \ DateTimeZone ( $ origin_tz ) ; $ remote_dtz = new \ DateTimeZone ( $ remote_tz ) ; $ origin_dt = new \ DateTime ( "now" , $ origin_dtz ) ; $ remote_dt = new \ DateTime ( "now" , $ remote_dtz ) ; $ offset = $ remote_dtz -> getOffset ( $ remote_dt ) - $ origin_dtz -> getOffset ( $ origin_dt ) ; return $ offset / 3600 . $ format ; }
Get timezone offset in hours

@param  string $origin_tz
@param  string $format
@return int
Get timezone offset in hours