(time_str, to_timezone, date_=None)
return as_timezone.strftime('%H:%M')
Format time strings for OpenClinica.

    >>> from pytz import timezone
    >>> oc_format_time('13:11:12.000Z', timezone('US/Eastern'))
    '08:11'
    >>> oc_format_time('15:11:12.000+02', timezone('US/Eastern'))
    '08:11'
Format time strings for OpenClinica.
Format time strings for OpenClinica .
def oc_format_time(time_str, to_timezone, date_=None):
    """
    Format time strings for OpenClinica.

    >>> from pytz import timezone
    >>> oc_format_time('13:11:12.000Z', timezone('US/Eastern'))
    '08:11'
    >>> oc_format_time('15:11:12.000+02', timezone('US/Eastern'))
    '08:11'

    """
    match = re.match(r'^\d{2}:\d{2}:\d{2}.\d+([\+-]\d+|Z)$', time_str)
    if not match:
        return time_str
    tz_str = match.group(1)
    tz_offset = pytz.FixedOffset(get_tz_mins(tz_str))

    time_ = strptime(time_str, '%H:%M:%S.%f{}'.format(tz_str))
    if date_ is None:
        year, month, day = 2000, 1, 1
    else:
        year, month, day = date_.year, date_.month, date_.day
    datetime_ = datetime(
        year, month, day,
        time_.tm_hour, time_.tm_min, time_.tm_sec,
        tzinfo=tz_offset
    )
    as_timezone = datetime_.astimezone(to_timezone)
    return as_timezone.strftime('%H:%M')
def oc_format_time ( time_str , to_timezone , date_ = None ) : match = re . match ( r'^\d{2}:\d{2}:\d{2}.\d+([\+-]\d+|Z)$' , time_str ) if not match : return time_str tz_str = match . group ( 1 ) tz_offset = pytz . FixedOffset ( get_tz_mins ( tz_str ) ) time_ = strptime ( time_str , '%H:%M:%S.%f{}' . format ( tz_str ) ) if date_ is None : year , month , day = 2000 , 1 , 1 else : year , month , day = date_ . year , date_ . month , date_ . day datetime_ = datetime ( year , month , day , time_ . tm_hour , time_ . tm_min , time_ . tm_sec , tzinfo = tz_offset ) as_timezone = datetime_ . astimezone ( to_timezone ) return as_timezone . strftime ( '%H:%M' )