(time_str, tz="US/Pacific")
return t.to("utc")
Convert a date or time string into an arrow object in UTC

    :param time_str: the string to convert
    :param tz: what timezone to interpret the time_str as *if no tz is specified*
    :returns: an arrow object representing the time_str in UTC
    :raises ValueError: if the time_str could not be parsed
Convert a date or time string into an arrow object in UTC
Convert a date or time string into an arrow object in UTC
def parse_time_string(time_str, tz="US/Pacific"):
    """ Convert a date or time string into an arrow object in UTC

    :param time_str: the string to convert
    :param tz: what timezone to interpret the time_str as *if no tz is specified*
    :returns: an arrow object representing the time_str in UTC
    :raises ValueError: if the time_str could not be parsed
    """

    # parsedatetime doesn't handle ISO-8601 time strings (YYYY-MM-DDThh:mm:ss+zz) so
    # try to parse it with arrow first and then use parsedatetime as a fallback (grumble)
    t = None
    try:
        t = arrow.get(time_str)
        # If the input string didn't specify a timezone, fill in the default
        if len(time_str.split("+")) == 1:
            t = t.replace(tzinfo=tz)
    except arrow.parser.ParserError:
        cal = parsedatetime.Calendar()
        parse_result = cal.parse(time_str)
        if parse_result[1] == 0:
            raise ValueError("Could not understand time {time}".format(time=time_str))
        t = arrow.get(parse_result[0]).replace(tzinfo=tz)
    return t.to("utc")
def parse_time_string ( time_str , tz = "US/Pacific" ) : # parsedatetime doesn't handle ISO-8601 time strings (YYYY-MM-DDThh:mm:ss+zz) so # try to parse it with arrow first and then use parsedatetime as a fallback (grumble) t = None try : t = arrow . get ( time_str ) # If the input string didn't specify a timezone, fill in the default if len ( time_str . split ( "+" ) ) == 1 : t = t . replace ( tzinfo = tz ) except arrow . parser . ParserError : cal = parsedatetime . Calendar ( ) parse_result = cal . parse ( time_str ) if parse_result [ 1 ] == 0 : raise ValueError ( "Could not understand time {time}" . format ( time = time_str ) ) t = arrow . get ( parse_result [ 0 ] ) . replace ( tzinfo = tz ) return t . to ( "utc" )