from datetime import date, datetime, timezone
# Month counts from 1
victory_date = date(1945, 5, 9)
# Midnight when no time is given
victory_date_time = datetime(year=1945, month=5, day=9)
# With a time
victory_moment = datetime(1945, 5, 9, 1, 0)
# With a time zone
victory_utc = datetime(1945, 5, 9, tzinfo=timezone.utc)
# Trap: a day that does not exist
try:
date(1945, 2, 30)
except ValueError as error:
print(f"{error = }")
print(f"{victory_date = }")
print(f"{victory_date_time = }")
print(f"{victory_moment = }")
print(f"{victory_utc = }")