Tuesday, April 30, 2019

Re: DateTimeField is in UTC but need IST standards

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.

On Tue, 30 Apr 2019, 18:09 Sampath Reddy, <sampath.nandyala@gmail.com> wrote:
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


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAMMZq8M7JYBuimPbkvH_ot_yB%3DUw4Gj1w%3DRZXyWFfw3GuYPNMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment