(tz_str)
return sign * (hours * 60 + mins)
Return the timezone offset in minutes

    >>> get_tz_mins('Z')
    0
    >>> get_tz_mins('-05')
    -300
    >>> get_tz_mins('+0530')
    330
Return the timezone offset in minutes
Return the timezone offset in minutes
def get_tz_mins(tz_str):
    """
    Return the timezone offset in minutes

    >>> get_tz_mins('Z')
    0
    >>> get_tz_mins('-05')
    -300
    >>> get_tz_mins('+0530')
    330

    """
    match = re.match(r'^(Z|(?P<sign>[+-])(?P<hours>\d{2}):?(?P<mins>\d{2})?)$', tz_str)
    if not match:
        raise ValueError('Unrecognized timezone offset')
    if tz_str == 'Z':
        return 0
    sign = 1 if match.group('sign') == '+' else -1
    hours = int(match.group('hours'))
    mins = int(match.group('mins') or 0)
    return sign * (hours * 60 + mins)
def get_tz_mins ( tz_str ) : match = re . match ( r'^(Z|(?P<sign>[+-])(?P<hours>\d{2}):?(?P<mins>\d{2})?)$' , tz_str ) if not match : raise ValueError ( 'Unrecognized timezone offset' ) if tz_str == 'Z' : return 0 sign = 1 if match . group ( 'sign' ) == '+' else - 1 hours = int ( match . group ( 'hours' ) ) mins = int ( match . group ( 'mins' ) or 0 ) return sign * ( hours * 60 + mins )