e-paper-display/examples/time-diff.py
2024-11-25 22:52:42 +01:00

21 lines
589 B
Python

import time
import datetime
import locale
loc = locale.getlocale()
print (loc)
from datetime import datetime, timedelta, date
# Zwei datetime-Objekte erstellen
# from datetime import date
start_time = date.today()
print(start_time.strftime("%d.%m.%Y"))
ruhestand = date(2025, 6, 10)
# Zeitdelta berechnen
duration = ruhestand - start_time
print("Tage: " + str(duration.days))
print("Wochen: " + str(round(duration.days / 7,3)))
print("Monate: " + str(round(duration.days / 30,3)))
print("Jahre: " + str(round(duration.days / 365,3)))
print("Stunden: " + str(duration.days *24))