datetime seems to be broken WRT timezones (even when you add them)

Python python at bladeshadow.org
Mon Feb 10 19:02:14 EST 2020


On Mon, Feb 10, 2020 at 05:52:59PM -0600, Skip Montanaro wrote:
> > As best I can tell, Python has no means to make use of the system's
> > timezone info.  In order to make datetime "timezone aware", you need
> > to manually create a subclass of datetime.tzinfo, whose methods return
> > the correct values for the timezone you care about.
> >
>  ...
> 
> > Does Python have an alternative way to do the above, with correct
> > results?
> >
> 
> The datetime module's manipulation of timezones is pretty low-level. Maybe
> try arrow?
> 
> https://arrow.readthedocs.io/en/latest/

Yeah, this looks like exacly what I'm looking for, but I need
something that's part of the standard Python distribution, due to
constraints I have no control over.  [This is perhaps not strictly
true, but for all intents and purposes...] 

FWIW, manipulating dates on POSIX systems is pretty much a nightmare,
so it's hard to blame Python entirely for the state of things.

Thanks though.



More information about the Python-list mailing list