Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRonnie Barua
17,665 PointsWhat am I doing wrong with Starter is a naive datetime?
import datetime import pytz pacific = pytz.timezone('US/Pacific') fmt = '%m-%d %H:%M %Z%z' starter = pacific.localize(datetime.datetime(2015, 10, 21, 4, 29)) starter.strftime(fmt) starter_pacific = starter.astimezone(pacific)
import datetime
import pytz
pacific = pytz.timezone('US/Pacific')
fmt = '%m-%d %H:%M %Z%z'
starter = pacific.localize(datetime.datetime(2015, 10, 21, 4, 29))
starter.strftime(fmt)
starter_pacific = starter.astimezone(pacific)
4 Answers
Kenneth Love
Treehouse Guest TeacherDon't change starter
. Use starter
and pytz
to make a new datetime
, named local
, that is starter
in the US/Pacific timezone. Since starter
is naive, you can't use astimezone()
on it.
Ronnie Barua
17,665 PointsThank you so much Kenneth.
Ronnie Barua
17,665 PointsThanks again. I have finally passed with your help.
Jose Luis Lopez
19,179 PointsI had a really bad time with this exercise, but I finally passed it. We do not need to change any of the code that your are giving us right?. Therefore, we have to make a new variable with the name 'local' that will contain the starter code but also to make a time zone like in the video. this is a good exercise