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 trial

Python Dates and Times in Python (2014) Where on Earth do Timezones Make Sense? Actually, Use pytz Instead

Welby Obeng
Welby Obeng
20,340 Points

how come the teacher didnt localize naive time zone and instead converted an eastern timezone

Video duration : 6:45

Kenneth Love started with naive datetime, localize it to eastern then converted it to utc.

how come the teacher didn't localize naive time zone straight to eastern and instead converted an eastern timezone to utc time zone? didn't he get the eastern timezone from localizing naive?

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

For that, yeah, it's mostly illustrative. But in the real world, you'd, ideally, have a naive datetime that you know where it was created. You'd then localize it to that timezone, then convert to UTC (unless you're lucky enough to have created it in UTC to begin with).

for teaching purposes maybe?