Timezone in Django

When building software, apart from creating a secure and robust back end, and an intuitive front end design, we have to focus on date and time. Date and time might not be essential elements in most software, but they still play a vital role in enhancing user experience.

In Django, setting up a local time zone is relatively simple. By default, Django uses UTC or Coordinated Universal Time or Universal Time Coordinated.

In settings.py, we have to configure the TIME_ZONE variable to set the local time zone.

TIME_ZONE = 'Asia/Kolkata'
TIME_ZONE = 'Asia/Beirut'
TIME_ZONE = 'Europe/London'
TIME_ZONE = 'Europe/Istanbul'

The value follows the following format - Area/Location. You can find all the valid values here.

DelftStack is a collective effort contributed by software geeks like you. If you like the article and would like to contribute to DelftStack by writing paid articles, you can check the write for us page.