Looking for django Answers? Try Ask4KnowledgeBase
Looking for django Keywords? Try Ask4Keywords

Django Setting the timezone


Example

You can set the timezone that will be used by Django in the settings.py file. Examples:

TIME_ZONE = 'UTC'  # use this, whenever possible
TIME_ZONE = 'Europe/Berlin'
TIME_ZONE = 'Etc/GMT+1'

Here is the list of valid timezones

When running in a Windows environment this must be set to the same as your system time zone.

If you do not want Django to use timezone-aware datetimes:

USE_TZ = False

Django best practices call for using UTC for storing information in the database:

Even if your website is available in only one time zone, it’s still good practice to store data in UTC in your database. The main reason is Daylight Saving Time (DST). Many countries have a system of DST, where clocks are moved forward in spring and backward in autumn. If you’re working in local time, you’re likely to encounter errors twice a year, when the transitions happen.

https://docs.djangoproject.com/en/stable/topics/i18n/timezones/