i have a variable that stores the number of years between two dates, if i loop through the codeblock and use it a second time it says i cant minus two dates from each other, yet it works on the first loop to return the difference between two dates. what am i doing wrong?
DOB = datetime(1985,2,28)
while continue_search:
SearchName = str(input(" Name Query: >"))
if first_name.upper() in SearchName.upper():
if last_name.upper() in SearchName.upper():
print(f'\n LAST NAME: {last_name}')
print(f' FIRST NAME: {first_name}')
print(f' SEX: {Sex}')
print(f' RACE: {Race}')
diff = ((datetime.now() - DOB).days + (datetime.now() - DOB).seconds/86400)/365.2425
diff = math.floor(diff)
DOB = DOB.date()
print(f' AGE: {diff} DOB: {DOB}\n')
its on this line:
diff = ((datetime.now() - DOB).days + (datetime.now() - DOB).seconds/86400)/365.2425
that it wont work the second time round.