Author belopolsky
Recipients akira, belopolsky
Date 2014-08-22.00:25:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408667132.32.0.753090532164.issue22241@psf.upfronthosting.co.za>
In-reply-to
Content
I see.  I thought you were complaining about "%z" format not supporting "00:00" as in 

>>> from datetime import *
>>> datetime.strptime("00:00","%z")
Traceback (most recent call last):
 ..
ValueError: time data '00:00' does not match format '%z'

but your issue is that %Z does not parse "UTC+00:00" as in

>>> datetime.strptime("UTC+00:00x","%Zx")
Traceback (most recent call last):
 ..
ValueError: time data 'UTC+00:00x' does not match format '%Zx'

The name produced by timezone when no name is explicitly specified is documented:

https://docs.python.org/3.4/library/datetime.html#datetime.timezone.tzname


> Can datetime.now(timezone.utc).strftime('%Z') be changed to return 'UTC'?

I think it can.  I am surprised this did not come up in #5094 where UTC±hh:mm syntax was discussed.

The change would be trivial - just supply explicit name to utc singleton.

Please ask on Python-Dev if anyone would object.
History
Date User Action Args
2014-08-22 00:25:32belopolskysetrecipients: + belopolsky, akira
2014-08-22 00:25:32belopolskysetmessageid: <1408667132.32.0.753090532164.issue22241@psf.upfronthosting.co.za>
2014-08-22 00:25:32belopolskylinkissue22241 messages
2014-08-22 00:25:30belopolskycreate