始める無料で始める

自転車は何時に出発しましたか?(グローバル編)

datetime をあるタイムゾーンから別のタイムゾーンへ変換するときは、.astimezone()tz を使います。多くの場合は UTC に変換しますが、ここでは練習として 'America/New_York' からいくつかの異なるタイムゾーンへ変換してみましょう。

この演習はコースの一部です

Pythonで扱う日付と時刻

コースを見る

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# 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())
コードを編集して実行