[Chicago] Working with timezones

Chris Foresman foresmac at gmail.com
Fri Nov 18 16:30:33 EST 2016


Yeah, it’s a little more processing intensive  than I would like, but it’ll do. Thanks!


Chris Foresman
foresmac at gmail.com




> On Nov 18, 2016, at 3:07 PM, Jordan Bettis <jordanb at hafd.org> wrote:
> 
> You shouldn't have to build your own database, and that would be a
> herculean task in any case. The Olsen database what everyone already
> uses (including pytz).
> 
> This SO question seems to be close to what you want. There are several
> answers but they all revolve around iterating the Olsen database, mainly
> through pytz, which does expose it in python:
> 
> http://stackoverflow.com/questions/7669938/get-the-olson-tz-name-for-the-local-timezone
> 
> On 11/18/2016 02:33 PM, Chris Foresman wrote:
>> Ugh, dealing with time/timezones is the worst, AMIRITE? Here’s what I need to do:
>> 
>> Calculate an offset from UTC, and use the offset to get a list of corresponding timezone names, i.e., I’ve detmerined that I need all the timezones associated with offset -06:00; which includes “America/Chicago”, “CT”, etc. I looked at pytz, but it looks like it only goes the other direction, i.e. pytz.timezone(‘America/Chicago’) will give me a tzinfo instance with UTC offset -06:00.
>> 
>> Outside of building my own reverse database, does anyone have ideas how to make this work?
>> 
>> 
>> Thanks, 
>> Chris Foresman
>> foresmac at gmail.com
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Chicago mailing list
>> Chicago at python.org
>> https://mail.python.org/mailman/listinfo/chicago
>> 
> 
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> https://mail.python.org/mailman/listinfo/chicago



More information about the Chicago mailing list