until today
Ich wurde am 25. April 1952 geboren.
Bedeutet: ich bin heute,
am
30. 01. 2025
,
72
Jahre und
280
Tage alt.
from datetime import date, datetime today = date.today() birth = '04/25/1952' birth_date = datetime.strptime(datetime.strptime( birth, '%m/%d/%Y').strftime('%Y-%m-%d'), '%Y-%m-%d').date() delta = today - birth_date days = delta.days year_counter = 0 if today.day >= birth_date.day and today.month >= birth_date.month: full_years = today.year else: full_years = today.year - 1 for year in range(1952, full_years): if (year % 4) == 0 or (year % 100) == 0 or (year % 400) == 0: days -= 366 year_counter += 1 else: days -= 365 year_counter += 1 import time print("am ") print (time.strftime("%d. %m. %Y")) print(", ") print(str(year_counter)) print("Jahre und ") print(str(days)) print("Tage alt.")▸ up