Piwik\Date::extractUtcOffset PHP Method

extractUtcOffset() protected static method

Helper function that returns the offset in the timezone string 'UTC+14' Returns false if the timezone is not UTC+X or UTC-X
protected static extractUtcOffset ( string $timezone ) : integer | boolean
$timezone string
return integer | boolean utc offset or false
    protected static function extractUtcOffset($timezone)
    {
        if ($timezone == 'UTC') {
            return 0;
        }
        $start = substr($timezone, 0, 4);
        if ($start != 'UTC-' && $start != 'UTC+') {
            return false;
        }
        $offset = (double) substr($timezone, 4);
        if ($start == 'UTC-') {
            $offset = -$offset;
        }
        return $offset;
    }