Answers for "Format UTC to local timezone using PYTZ for Django"

0

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)
Posted by: Guest on April-11-2022

Code answers related to "Format UTC to local timezone using PYTZ for Django"

Python Answers by Framework

Browse Popular Code Answers by Language