How to set the timezone in Django?

后端 未结 8 920
萌比男神i
萌比男神i 2020-11-29 19:33

In my django project\'s settings.py file, I have this line :

TIME_ZONE = \'UTC\'

But I want my app to run in UTC+2 timezone, s

8条回答
  •  旧时难觅i
    2020-11-29 20:23

    Universal solution, based on Django's TZ name support:

    UTC-2 = 'Etc/GMT+2'
    UTC-1 = 'Etc/GMT+1'
    UTC = 'Etc/GMT+0'
    UTC+1 = 'Etc/GMT-1'
    UTC+2 = 'Etc/GMT-2'
    

    +/- is intentionally switched.

提交回复
热议问题