def timestampdate(context, val, asvar=None): import pytz from lifestream.providers.utils import utc_to_local_datetime date = val['lifestream:timestamp'] if asvar: context[asvar] = utc_to_local_datetime(date.replace(tzinfo=pytz.timezone('UTC'))).date() return "" else: return date
def to_local(value): import pytz from lifestream.providers.utils import utc_to_local_datetime local = utc_to_local_datetime(value.replace(tzinfo=pytz.timezone('UTC'))).replace(tzinfo=None) return local