Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Format UTC to local timezone using PYTZ for Django

import pytz
book_obj = Book.objects.get(pk=1)  # Replace query parameters according to your needs
my_timezone = pytz.timezone("Asia/Kolkata") # Replace Asia/Kolkata with your timezone
local_created_at = book_obj.created_at.astimezone(my_timezone)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Format #UTC #local #timezone #PYTZ #Django
ADD COMMENT
Topic
Name
6+3 =