Re: Improving support for timezones in Python (was: UTC "timezone" causing brain explosions)

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 1:26 PM, Ben Finney wrote: > He also reinforces the message that UTC is the canonical timezone for > storing and manipulating timestamp values, and we should be converting > to/from those canonical values as early/late as possible in our programs. Call it a "UTC Sandwich",

Improving support for timezones in Python (was: UTC "timezone" causing brain explosions)

2014-01-30 Thread Ben Finney
Ben Finney writes: > Time zones are a hairy beast to manage, made all the more difficult > because national politicians continually fiddle with them which means > they can't just be a built-in part of the Python standard library. PyCon 2013 had a good talk on calendaring and timezone issues http

Re: UTC "timezone" causing brain explosions

2014-01-29 Thread Chris Rebert
On Wed, Jan 29, 2014 at 1:52 PM, Skip Montanaro wrote: > Following up on my earlier note about UTC v. GMT, I am having some > trouble grokking attempts to convert a datetime into UTC. Consider > these three values: > import pytz UTC = pytz.timezone("UTC") LOCAL_TZ = pytz.timezone("A

Re: UTC "timezone" causing brain explosions

2014-01-29 Thread Ben Finney
Skip Montanaro writes: > Following up on my earlier note about UTC v. GMT, I am having some > trouble grokking attempts to convert a datetime into UTC. For what it's worth, you're not alone. Time zones are a hairy beast to manage, made all the more difficult because national politicians continua

Re: UTC "timezone" causing brain explosions

2014-01-29 Thread Ethan Furman
On 01/29/2014 01:52 PM, Skip Montanaro wrote: Following up on my earlier note about UTC v. GMT, I am having some trouble grokking attempts to convert a datetime into UTC. Okay, let's see what GMT does for us: GMT = pytz.timezone("GMT") u = GMT.normalize(s) u datetime.datetime(2014, 1, 29, 21,

UTC "timezone" causing brain explosions

2014-01-29 Thread Skip Montanaro
Following up on my earlier note about UTC v. GMT, I am having some trouble grokking attempts to convert a datetime into UTC. Consider these three values: >>> import pytz >>> UTC = pytz.timezone("UTC") >>> UTC >>> LOCAL_TZ = pytz.timezone("America/Chicago") >>> LOCAL_TZ >>> now = datetime.datetim