Alexander Belopolsky added the comment: This is not a bug in datetime.timezone. The value returned by timezone.tzname() is documented and the code works correctly. %Z should not be used to produce machine-readable timestamps and for a human reader 'UTC+03:00+0300' should not be confusing.
Note that calling the astimezone() method (without arguments) will return local time with tzname set: >>> os.putenv('TZ', 'XYZ-3') >>> time.tzset() >>> utctime = datetime.datetime.now(datetime.timezone.utc) >>> localtime = utctime.astimezone() >>> localtime.strftime('%Z%z') 'XYZ+0300' ---------- nosy: +belopolsky resolution: -> invalid status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17486> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com