This helper function can help (assuming the OpenERP server is in the same timezone as the pingen server)
def to_utc_time(time): if isinstance(time, (str, unicode)): time = datetime.strptime(time, '%Y-%m-%d %H:%M:%S') assert isinstance(time, datetime) from_zone = tz.tzlocal() to_zone = tz.tzutc() time = time.replace(tzinfo=from_zone) return time.astimezone(to_zone)
This helper function can help (assuming the OpenERP server is in the same timezone as the pingen server)
def to_utc_time(time): strptime( time, '%Y-%m-%d %H:%M:%S') tzinfo= from_zone) (to_zone)
if isinstance(time, (str, unicode)):
time = datetime.
assert isinstance(time, datetime)
from_zone = tz.tzlocal()
to_zone = tz.tzutc()
time = time.replace(
return time.astimezone