[New-bugs-announce] [issue12750] datetime.datetime timezone problems

Daniel O'Connor report at bugs.python.org
Mon Aug 15 04:31:13 CEST 2011

New submission from Daniel O'Connor <darius at dons.net.au>:

It isn't possible to add a timezone to a naive datetime object which means that if you are getting them from some place you can't directly control there is no way to set the TZ.

eg pywws' DataStore returns naive datetime's which are in UTC. There is no way to set this and hence strftime seems to think they are in local time.

I can sort of see why you would disallow changing a TZ once set but it doesn't make sense to prevent this for naive DTs.

Also, utcnow() returns a naive DT whereas it would seem to be more sensible to return it with a UTC TZ.

components: Library (Lib)
messages: 142095
nosy: Daniel.O'Connor
priority: normal
severity: normal
status: open
title: datetime.datetime timezone problems
type: feature request
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list