datetime.datetime.now():输出的永远是本地时间
datetime.datetime.utcnow():则输出的是UTC时间
django.util.timezone.now():
若是setting中配置USE_TZ=True则输出的是UTC时间,
若是配置USE_TZ=False,则与datetime.datetime.now()彻底相同。数据库
只要设置了USE_TZ=True,django.util.timezone.now()输出地永远是UTC时间,不管设置的TIME_ZONE是什么。
若是USE_TZ=False,则django.util.timezone.now()输出等同于datetime.datetime.now(),不管TIME_ZONE设置的是什么。django