Alexander Belopolsky added the comment: 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. ---------- keywords: +easy resolution: duplicate -> status: closed -> open superseder: datetime: add ability to parse RFC 3339 dates and times -> _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22241> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com