Menu Close

How to set the time zone in Python Django?

Sometimes, we want to set the time zone in Python Django.

In this article, we’ll look at how to set the time zone in Python Django.

How to set the time zone in Python Django?

To set the time zone in Python Django, we can set the TIME_ZONE setting in settings.py.

For instance, we write

TIME_ZONE = 'Europe/Amsterdam'

to set TIME_ZONE to the time zone we want in settings.py.

We can get the list of valid time zones from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

Conclusion

To set the time zone in Python Django, we can set the TIME_ZONE setting in settings.py.

Posted in Python, Python Answers