How many hours elapsed around daylight saving?
Since our bike data takes place in the fall, you'll have to do something else to learn about the start of daylight savings time.
Let's look at March 12, 2017, in the Eastern United States, when Daylight Saving kicked in at 2 AM.
If you create a datetime
for midnight that night, and add 6 hours to it, how much time will have elapsed?
This exercise is part of the course
Working with Dates and Times in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import datetime, timedelta, tz, timezone
from datetime import datetime, timedelta, timezone
from dateutil import tz
# Start on March 12, 2017, midnight, then add 6 hours
start = datetime(2017, 3, 12, tzinfo = tz.gettz('America/New_York'))
end = start + ____(____)
print(start.isoformat() + " to " + end.isoformat())