IniziaInizia gratis

What time did the bike leave? (Global edition)

When you need to move a datetime from one timezone into another, use .astimezone() and tz. Often you will be moving things into UTC, but for fun let's try moving things from 'America/New_York' into a few different time zones.

Questo esercizio fa parte del corso

Working with Dates and Times in Python

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Create the timezone object
uk = ____

# Pull out the start of the first trip
local = onebike_datetimes[0]['start']

# What time was it in the UK?
notlocal = local.____(____)

# Print them out and see the difference
print(local.isoformat())
print(notlocal.isoformat())
Modifica ed esegui il codice