1. Playing with datetimes¶
You're given a naive datetime, see NAIVE_DT variable below. Although this variable is naive, you happen to know that the time specified by NAIVE_DT is in UTC.
Based on this information, your task is to create new datetime variables by converting NAIVE_DT to UTC and then to time in Sydney and Los Angeles. Use the following variable names: utc_dt, sydney_dt, and la_dt.
In [ ]:
import datetime as dt
from zoneinfo import ZoneInfo, available_timezones
NAIVE_DT = dt.datetime(2000, 1, 1, 10)
If you don't know the timezone name you're looking for, this may be helpful:
In [ ]:
for tz in available_timezones():
print(tz)
Now create utc_dt, sydney_dt, and la_dt.
In [ ]:
# Your implementation here
Let's verify that the solution is correct.
In [ ]:
assert utc_dt.isoformat() == "2000-01-01T10:00:00+00:00"
assert sydney_dt.isoformat() == "2000-01-01T21:00:00+11:00"
assert la_dt.isoformat() == "2000-01-01T02:00:00-08:00"
print("All good!")