[Python-Dev] Status on PEP-431 Timezones
Jon Ribbens
jon+python-dev at unequivocal.co.uk
Tue Jul 28 11:35:20 CEST 2015
On Mon, Jul 27, 2015 at 04:28:48PM -0700, Chris Barker wrote:
> > The only other thing I found
> > really weird about datetime is how Python 2 had no implementation of
> > a UTC tzinfo class, despite this being utterly trivial -
>
> Huh? it is either so trivial that there is no point -- simiply say that
> your datetimes are UTC, and you are done.
> Or it's not the least bit trivial -- the only difference between a UTC
> datetime and a "naive" datetime is that one can be converted to (or
> interact with) other time zones. Except that, as we know from this
> conversation, is very, very non-trivial!
No, it has nothing to do with conversions. The difference between a
naive timezone and a UTC one is that the UTC one explicitly specifies
that it's UTC and not "local time" or some other assumed or unknown
timezone. This can make a big difference when passing datetime
objects to third-party libraries, such as database interfaces.
More information about the Python-Dev
mailing list