osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


> 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/

Skip

>