How do I setup my own time zone in Django?

Viewed 2494

I live in Chittagong, Bangladesh and my time zone is GMT+6. How can i change to this time zone in Django settings?

2 Answers

You can specify the timezone as 'Asia/Dhaka' in the TIME_ZONE setting [Django-doc]:

# settings.py

TIME_ZONE = 'Asia/Dhaka'
# …

Note that if USE_TZ setting [Django-doc] is set to True, then:

When USE_TZ is True, this is the default time zone that Django will use to display datetimes in templates and to interpret datetimes entered in forms.

You can define your own time zone in setting.py, USE_TZ = True TIME_ZONE = 'Asia/Dhaka'. Django documentation

Related