I've the following settings:-
TIME_ZONE = 'Asia/Kolkata'
USE_I18N = True
USE_L10N = True
USE_TZ = True
Also, I've set auto_now = True
in my DateTimeField
's. However, the datetime that gets saved in the column in of UTC (ie -5:30 hours).
I have set my system date as per the Asia/Kolkata
timezone. Also,
>>> from django.utils import timezone
>>> from datetime import datetime
>>>
>>> datetime.now()
datetime.datetime(2019, 7, 13, 17, 40, 1, 505516) # this is right
>>> timezone.now()
datetime.datetime(2019, 7, 13, 12, 10, 6, 496772, tzinfo=<UTC>) # this is not what I expect.
Why is there a discrepency in timezone.now()
even when TIME_ZONE
is rightly set??