Hi All,

I am trying to store the date with the timezone.
for example, my servers are in Mumbai, when my servers are trying to get
the time of America/Detroit. it is not able to get proper time

Here is the snippet and details
[image: Screenshot from 2023-08-16 08-00-21.png]
def get_created_at(timezone):
local_tz = pytz.timezone(timezone)
print(datetime.utcnow())
created_at = local_tz.localize(datetime.utcnow()).astimezone(tz=pytz.
timezone(timezone))
return created_at


-- 
Best regards,
Madhusudhan
+91 90007 79457
Gmail <[email protected]> | LinkedIn
<https://www.linkedin.com/in/msreddygone/>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwQctLvw9KinV8a%3DVTysi_NSNJfu3rodBoBPCY5Cih_ih-DGQ%40mail.gmail.com.

Reply via email to