This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients Raghunath Lingutla, belopolsky, p-ganssle, xtreak
Date 2018-09-25.11:06:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537873590.61.0.545547206417.issue33940@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for the report Raghunath. Regarding timezone detection there is a limitation with %Z supporting only UTC, GMT and `time.tzname` which is not documented and it's an open issue tracked at issue22377 . Regarding a directive to determine Era I think it falls under a feature request and compile error is used for errors during compiling python interpreter itself. So I am changing this from compile error to enhancement.

# Support for GMT, UTC and error on PDT

$ ./python.exe
Python 3.8.0a0 (heads/master:f6c8007a29, Sep 25 2018, 12:30:43)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.strptime("2018-06-14 10:10:11 GMT", "%Y-%m-%d %H:%M:%S %Z")
datetime.datetime(2018, 6, 14, 10, 10, 11)
>>> datetime.datetime.strptime("2018-06-14 10:10:11 UTC", "%Y-%m-%d %H:%M:%S %Z")
datetime.datetime(2018, 6, 14, 10, 10, 11)
>>> datetime.datetime.strptime("2018-06-14 10:10:11 PDT", "%Y-%m-%d %H:%M:%S %Z")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '2018-06-14 10:10:11 PDT' does not match format '%Y-%m-%d %H:%M:%S %Z'

Hope this helps!

Thanks
History
Date User Action Args
2018-09-25 11:06:30xtreaksetrecipients: + xtreak, belopolsky, p-ganssle, Raghunath Lingutla
2018-09-25 11:06:30xtreaksetmessageid: <1537873590.61.0.545547206417.issue33940@psf.upfronthosting.co.za>
2018-09-25 11:06:30xtreaklinkissue33940 messages
2018-09-25 11:06:30xtreakcreate