Python_Unittests/old/date.py
2020-12-13 01:03:54 +01:00

20 lines
516 B
Python

from datetime import datetime
def get_input() -> str:
input_value = input('Datum: ')
if input_value == 'x':
exit()
return input_value
if __name__ == '__main__':
while True:
try:
value1 = datetime.strptime(get_input(), '%d.%m.%Y')
value2 = datetime.strptime(get_input(), '%d.%m.%Y')
print(f'Die Differenz aus {value2} und {value2} ist {abs((value1 - value2).days)}')
except Exception as e:
print(f'Ungültige Eingabe! {e}')