homepage

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 akira
Recipients akira
Date 2014年08月21日.11:35:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408620917.6.0.856660367054.issue22241@psf.upfronthosting.co.za>
In-reply-to
Content
>>> from datetime import datetime, timezone
 >>> dt = datetime.now(timezone.utc)
 >>> fmt = '%Y-%m-%d %H:%M:%S.%f %Z%z'
 >>> datetime.strptime(dt.strftime(fmt), fmt)
 Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/cpython/Lib/_strptime.py", line 500, in _strptime_datetime
 tt, fraction = _strptime(data_string, format)
 File "/cpython/Lib/_strptime.py", line 337, in _strptime
 (data_string, format))
 ValueError: time data '2014-08-21 11:29:13.537251 UTC+00:00+0000'
 does not match format '%Y-%m-%d %H:%M:%S.%f %Z%z'
The issue is that dt.strftime('%Z') produces 'UTC+00:00'
(due to timezone.utc.tzname(dt) returning 'UTC+00:00')
instead of 'UTC' that strptime() accepts and %Z examples [1]
in the docs demonstrate.
[1] https://docs.python.org/3.4/library/datetime.html#strftime-and-strptime-behavior 
History
Date User Action Args
2014年08月21日 11:35:17akirasetrecipients: + akira
2014年08月21日 11:35:17akirasetmessageid: <1408620917.6.0.856660367054.issue22241@psf.upfronthosting.co.za>
2014年08月21日 11:35:17akiralinkissue22241 messages
2014年08月21日 11:35:16akiracreate

AltStyle によって変換されたページ (->オリジナル) /