[issue12750] datetime.datetime timezone problems

Daniel O'Connor report at bugs.python.org
Mon Aug 15 16:23:44 CEST 2011


Daniel O'Connor <darius at dons.net.au> added the comment:

On 15/08/2011, at 23:39, R. David Murray wrote:
> R. David Murray <rdmurray at bitdance.com> added the comment:
> 
> In what way does 'replace' not satisfy your need to set the tzinfo?

Ahh that would work, although it is pretty clumsy since you have to specify everything else as well.

In the end I used calendar.timegm (which I only found out about after this).

> As for utcnow, we can't change what it returns for backward compatibility reasons, but you can get a non-naive utc datatime by doing ´

That is a pity :(

> datetime.now(timezone.utc).  (I must admit, however, that at least this morning I can't wrap my head around how that works based on the docs :(.

OK.. I am only using 2.7 so I can't try that :)

> 
> ----------
> nosy: +r.david.murray
> 
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue12750>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12750>
_______________________________________


More information about the Python-bugs-list mailing list