DateTimeField is in UTC but need IST standards

16 views
Skip to first unread message

Sampath Reddy

unread,
Apr 30, 2019, 8:40:15 AM4/30/19
to django...@googlegroups.com
Hey guys,

I am using DjangoRestFramework as tech stack to develop backend API points for my application.

I have a model with field created = models.DateTimeField(auto_now_add=True) in one of the models.

I am using mysql as backend db, now the problem I am having is I am not able to figure out how the timestamp is being generated. timestamp is in UTC.

But I want to store IST standards i.e TimeZone 'Asia/Kolkata'

I can confirm mysql database time settings and Django TimeZone settings are working as expected i.e IST standards.

Kindly someone please help me in figuring how the timestamp is being generated wen I am posting data to the table.

Thanks and Regards,
Sampath


vineeth sagar

unread,
Apr 30, 2019, 8:46:33 AM4/30/19
to django...@googlegroups.com
whenever USE_TZ=True is enabled, the timestamp is stored as a UTC object. This is standard practice, why?


Go through this, more than once. It'll be helpful.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAErixQ1YWANdnf21jOf0yxMcFRX0S1RExs4-%3DOMEY5v6pLNmsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages