Getting the current date

Basic types / Date and time

from datetime import date, datetime, timedelta, timezone, UTC
from zoneinfo import ZoneInfo

# Local time, no time zone attached
now = datetime.now()

# Date only
today = date.today()

utc_date = datetime.now(UTC)

# Fixed offset: UTC +1:00
london_date = datetime.now(timezone(timedelta(hours=1)))

# Zone by its IANA name: UTC +12:00
pacific_date = datetime.now(ZoneInfo('Pacific/Wake'))

print(f"{now = }")
print(f"{today = }")
print(f"{utc_date = }")
print(f"{london_date = }")
print(f"{pacific_date = }")