def append_offset_to_timezone(tz):
"""Appends offset value to timezone string:
Europe/London -> Europe/London (+000)
"""
if tz not in common_timezones:
return tz
offset = datetime.now(timezone(tz)).strftime('%z')
return '{0} ({1}:{2})'.format(tz, offset[:3], offset[3:])
评论列表
文章目录