How to set / change the timezone in Django ?

If you have followed to create your first django project “Starting webserver using your first simple Django project” , the default timezone “TIME_ZONE” argument is set to “UTC” as we can see in “my_django_project/”

[bash] # Internationalization # LANGUAGE_CODE = ‘en-us’ TIME_ZONE = ‘UTC’ USE_I18N = True USE_L10N = True USE_TZ = True [/bash]

Now, if you want to change the Time zone check the corresponding “TZ Database name” string from and modify “TIME_ZONE”,

so for example, if we want to change timezone to India then change TIME_ZONE to “Asia/Kolkata” as seen from wikipedia link.

For other variables,

USE_I18N refer to

USE_L10N refer to

When USE_TZ is False, time zone set from TIME_ZONE in which Django will store all datetimes. 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.

Leave a Comment