[Python-Dev] Status on PEP-431 Timezones (original) (raw)
Akira Li 4kir4.1i at gmail.com
Wed Apr 15 22:24:03 CEST 2015
- Previous message (by thread): [Python-Dev] Status on PEP-431 Timezones
- Next message (by thread): [Python-Dev] Status on PEP-431 Timezones
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Isaac Schwabacher <ischwabacher at wisc.edu> writes:
...
I know that you can do datetime.now(tz), and you can do datetime(2013, 11, 3, 1, 30, tzinfo=zoneinfo('America/Chicago')), but not being able to add a time zone to an existing naive datetime is painful (and strptime doesn't even let you pass in a time zone).
.now(tz)
is correct. datetime(..., tzinfo=tz)
) is wrong: if tz is a
pytz timezone then you may get a wrong tzinfo (LMT), you should use
tz.localize(naive_dt, is_dst=False|True|None)
instead.
...
- Previous message (by thread): [Python-Dev] Status on PEP-431 Timezones
- Next message (by thread): [Python-Dev] Status on PEP-431 Timezones
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]