1. Learn
  2. /
  3. Courses
  4. /
  5. Working with Dates and Times in Python

Connected

Exercise

Putting the bike trips into the right time zone

Instead of setting the timezones for W20529 by hand, let's assign them to their IANA timezone: 'America/New_York'. Since we know their political jurisdiction, we don't need to look up their UTC offset. Python will do that for us.

Instructions

100 XP
  • Import tz from dateutil.
  • Assign et to be the timezone 'America/New_York'.
  • Within the for loop, set start and end to have et as their timezone (use .replace()).