different time tuple format

wittempj@hotmail.com martin.witte at gmail.com
Wed Jun 8 21:16:15 CEST 2005


It is probably the best to calculate back to UTC.

Assume "2005-06-07 15:07:12"  the local time, then convert it as
follows to UTC. Use the UTC time to store/manipulate/whatever you want
to do.

import time
t = time.mktime(time.strptime("2005-06-07 15:07:12", "%Y-%m-%d
%H:%M:%S"))

print time.ctime(t)

offset = time.timezone
if time.daylight:
    offset = time.altzone
t += offset
print time.ctime(t)




More information about the Python-list mailing list