It seems that the main function called to convert datetimes to templates is django.utils.timezone.template_localtime() . Next to it in the source is another function of the localtime utility, which looks like this:
def localtime(value, timezone=None): """ Converts an aware datetime.datetime to local time. Local time is defined by the current time zone, unless another time zone is specified. """ ...
So, perhaps the following will work:
from django.utils.timezone import localtime, get_current_timezone ... print localtime(obj.date_created, user.get_profile().timezone or get_current_timezone())
source share