【发布时间】:2019-08-06 15:09:13
【问题描述】:
我正在使用 Python 3.7。我在我的设置文件中定义了这个...
TIME_ZONE = 'America/New York'
我想让“now()”函数知道时区,所以我可以做一些日期减法...
int(round((datetime.now(settings.TIME_ZONE) - article.created_on).total_seconds() / 60)) > 10
但我不断收到此错误
TypeError: tzinfo argument must be None or of a tzinfo subclass, not type 'str'
如何将常量转换为时区?
【问题讨论】:
标签: python python-3.x timezone date-math