def _get_date_time_format(dt_string):
    '''
    Copied from win_system.py (_get_date_time_format)

    Function that detects the date/time format for the string passed.

    :param str dt_string:
        A date/time string

    :return: The format of the passed dt_string
    :rtype: str
    '''
    valid_formats = [
        '%I:%M:%S %p',
        '%I:%M %p',
        '%H:%M:%S',
        '%H:%M',
        '%Y-%m-%d',
        '%m-%d-%y',
        '%m-%d-%Y',
        '%m/%d/%y',
        '%m/%d/%Y',
        '%Y/%m/%d'
    ]
    for dt_format in valid_formats:
        try:
            datetime.strptime(dt_string, dt_format)
            return dt_format
        except ValueError:
            continue
    return False
def _get_date_time_format ( dt_string ) : valid_formats = [ '%I:%M:%S %p' , '%I:%M %p' , '%H:%M:%S' , '%H:%M' , '%Y-%m-%d' , '%m-%d-%y' , '%m-%d-%Y' , '%m/%d/%y' , '%m/%d/%Y' , '%Y/%m/%d' ] for dt_format in valid_formats : try : datetime . strptime ( dt_string , dt_format ) return dt_format except ValueError : continue return False
Copied from win_system.py (_get_date_time_format)

    Function that detects the date/time format for the string passed.

    :param str dt_string:
        A date/time string

    :return: The format of the passed dt_string
    :rtype: str