Time not accurate in Production Server

I know this is not specifically related to django, but thought I might ask.

The thing is my app displays Time accurately in Development, and in the Production Server they have set the Time zone to = UTC, so I have converted my Views and settings.py to show the time in my local time, code Below:

TIME_ZONE = 'Indian/Maldives'
USE_I18N = True
USE_TZ = True

# app/views.py
import pytz
from django.utils import timezone

def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['time'] = timezone.localtime(self.object.trip_date, pytz.timezone("Indian/Maldives")).strftime("%H:%M %p")
        return context

and in my templates the code is:

   Created Time:{{time}}

And the time is still displayed in UTC time zone, is there a way I can convert to my local time through django, maybe add +5 hours to the Production Servers UTC time, when it is displayed on my templates or is there a way I could handle this, without configuring my production servers Time Zone. thanks

You’re might be looking for the astimezone function.

Also see Default and current time zone and Timezone aware output in templates

thanks for the pointer :+1: