1

我对 django 的日期时间有一些问题。

from datetime import datetime
d = datetime(2000, 1, 1, <what do i put here, nothing works>) 
# making it aware requires a 4th arg according to the docs, but no matter what
# i enter for that arg, it keeps giving me an error that  tzinfo argument 
must be None or of a tzinfo subclass

我在任何地方都找不到可以传递的可能 tzinfo 参数的可用选项……而且网上的所有东西都有 pytz 模块,它不在我的电脑上。如果可能的话,我怎么能在不使用 pytz 的情况下做到这一点?

谢谢

4

1 回答 1

0

没关系,我只是对自己花了这么多时间在这样的事情上感到生气,所以我没有直接思考,用时区的导入替换(tzinfo = timezone.utc)就可以了

于 2012-09-24T01:16:42.940 回答