如何在Django中添加印度标准时间(IST)? [英] How to add Indian Standard Time (IST) in Django?
本文介绍了如何在Django中添加印度标准时间(IST)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们想在Django项目中获取印度的当前时间。在settings.py中,默认情况下存在UTC。
We want to get the current time in India in our Django project. In settings.py, UTC is there by default. How do we change it to IST?
推荐答案
更改字段 TIME_ZONE
在 settings.py
中。
对于印度标准时间,您将需要:
Change the field TIME_ZONE
in the settings.py
.
For the Indian standard time you will need:
TIME_ZONE = 'Asia/Calcutta'
有关Django中TIME_ZONE的更多信息,请参见: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
For more information about the TIME_ZONE in Django you can see: https://docs.djangoproject.com/en/dev/ref/settings/#time-zone
这篇关于如何在Django中添加印度标准时间(IST)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文