django DateTimeField with UTC offset?

自古美人都是妖i 提交于 2019-12-03 11:15:31

When you set USE_TZ = True in your settings, Django stores date and time information in UTC in the database otherwise it will store naive date time (date time without timezone).

In most cases using Django's time zones support is very convenient because input and output datetime will be automatically translate by Django.

But if you really need timezone input from your user, you will need to set USE_TZ = False then use DateTimeField which is naive datetime along with CharField to store timezone information in your models.py.

ref: https://docs.djangoproject.com/en/1.4/topics/i18n/timezones/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!