different time tuple format

Maksim Kasimov kasimov at i.com.ua
Thu Jun 9 12:02:56 EDT 2005


maybe you are right, i've searched in google groups - such a question was posted to comp.lang.python many times and i has not found (yet) the answer on "how to tune up the output of time.strptime()?"


wittempj at hotmail.com wrote:
> 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)
> 


-- 
Best regards,
Maksim Kasimov
mailto: kasimov at i.com.ua



More information about the Python-list mailing list