def convert(value, row):
    if not value:
        row['admyr'], row['admmo'], row['admda'] = 9999, 99, 99
        return value

    from datetime import date
    from time import strptime
    
    try:
        v = value.replace('-', '')
        assert(len(v) == 8)
        assert(1850 <= int(value[:4]) <= date.today().year)
        dt = strptime(v, '%Y%m%d')
        row['admyr'], row['admmo'], row['admda'] = dt[0], dt[1], dt[2]
    except:
        row['admyr'], row['admmo'], row['admda'] = 9999, 99, 99
        log.write('admisdt', [row['id'], row['rapstatex'], value, "invalid date"])
                    
    return value