def create_tz(utcoffset=0) -> timezone:
"""
Create a python datetime.timezone with a given utc offset.
:param utcoffset: utc offset in seconds, if 0 timezone.utc is returned.
"""
if utcoffset == 0:
return timezone.utc
else:
return timezone(timedelta(seconds=utcoffset))
评论列表
文章目录