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 trialChris Freeman
Treehouse Moderator 68,441 PointsCan you provide an example a formated local string for this pytz format challenge?
From the Datess and Times in Python / Where on earth do timezones make sense / pytz format challenge, the wanted format appears to be:
>>> str(local)
'2015-10-21 04:29:00-07:00'
But the closest format string I can find does not provide the colon in the time zone, Bummer!
>>>fmt3 = "%Y-%M-%d %H:%M:%S%z"
>>>local.strftime(fmt3)
'2015-29-21 04:29:00-0700'
Is there an example of the desired properly formated string?
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Chris,
What's the full code that you're trying to pass with?
The challenge already provides you with an fmt
string that you should use when creating the pytz_string
variable. You don't have to create your own.
Kenneth Love
Treehouse Guest TeacherThanks for the notes! I've updated the code challenge so hopefully it'll make more sense to future students.
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsThanks. That wasn't clear to me from the wording of the challenge: "Now create a variable named pytz_string that is the fmt string from the local datetime."
I was over-reading the text. I was reading it as literally needing to find a fmt string from the local datetime. Since local datetime doesn't have an an attribute or method from which to obtain a fmt string, it lead me to think they wanted a format defined to be the same as the format that str() returns on a tz aware datetime, such as local. Insane as that seemed, I was then trying to mimic that format.
It would be clearer if stated as "Now create a variable named pytz_string from that the local datetime that is formated using the fmt string provided.