(val)
return parse(val)
Try to convert a string to a date.
Try to convert a string to a date.
Try to convert a string to a date .
def string_to_datetime(val):
    """
    Try to convert a string to a date.
    """
    if isinstance(val, datetime):
        return val
    elif isinstance(val, date):
        return datetime.combine(val, time())
    return parse(val)
def string_to_datetime ( val ) : if isinstance ( val , datetime ) : return val elif isinstance ( val , date ) : return datetime . combine ( val , time ( ) ) return parse ( val )