I'm a bit confused by the daylight savings handling. I have working on web notifier application in Django 2.0.6 framework and python 3.6. this application provide scheduling notification. for example users schedule message for some hours later or a few days later. this website is available in only one time zone.
I have use this settings in Django:
...
TIME_ZONE = 'Europe/London'
USE_I18N = True
USE_L10N = True
USE_TZ = True
...
when I run this code in python manage.py shell
:
>>> from django.utils import timezone
>>> from datetime import datetime
>>> timezone.now()
>>> datetime.now()
django timezone.now()
return to me datetime with tzinfo UTC and datetime.now()
return to me correct time information with correct time zone info. when I made USE_TZ=False
in django setting to find out timezone.now()
in django return correct time zone information like datetime.now()
. in Django time zone document said: ''This is handy if your users live in more than one time zone and you want to display datetime information according to each user’s wall clock.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''
Depending on my project type I'm looking for that what is the best practice for time zone config in my Django settings project and solve that problem Django talk about that in time documentation. Please help me
Thanks.