Dates and times
The datetime module handles dates and times. date(2026, 12, 25) creates a date, datetime(...) a date with a time, and date.today() gives today's date.
A timedelta represents a duration: you add it to or subtract it from a date. The difference between two dates is also a timedelta, whose .days gives the number of days. strftime() formats a date, for example "%d/%m/%Y" for 25/12/2026.
from datetime import date, datetime, timedelta
d = date(2026, 12, 25)
print(d.year, d.month, d.day)
print(d.strftime("%d/%m/%Y"))
print(d + timedelta(days=7))
print(date(2026, 12, 31) - date(2026, 12, 25))
moment = datetime(2026, 11, 15, 21, 30)
print(moment.strftime("%H:%M"))