import datetime from django.conf import settings from django.utils import timezone def get_current_time(): current_time = timezone.now() current_time_timezoned = current_time.astimezone(settings.TIME_ZONE_OBJECT) return current_time_timezoned def convert_to_local_time(datetime_obj: datetime.datetime): return datetime_obj.astimezone(settings.TIME_ZONE_OBJECT)