In my settings file, I have :
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Kolkata'
USE_I18N = True
USE_L10N = True
USE_TZ = True
in my views:
import datetime
def some_function:
print(datetime.datetime.now()) << prints my local time
However, when using the same datetime.datetime.now()
to store the current localtime into a DateTimeField, it gets converted in UTC.
I understand that its a good things that it all gets converted into UTC when being stored into Database. Objective being, it will be easier for us to convert UTC to any localtime when we are using these stored values and rendering to the user.
This last step, of converting UTC time to localtime, which I assume that django should do by default, is where I'm stuck at.
the datetime values are still being rendered as UTC instead of my localtime despite using USE_TZ = True
in my settings.