coverting EST to PST

Tim Williams (gmail) tdwdotnet at gmail.com
Wed Dec 21 09:42:23 EST 2005


On 21 Dec 2005 03:15:47 -0800, Narendra <narendra.amirinenis at gmail.com>
wrote:
>
> Hi All,
>
> i got a problem. I need to convert time from EST standard to PST
> standard.
>
> Thu, 15 Dec 2005 09:24:19 -0500 to PST
>

Quick and dirty,   might not work for times at the end of DST

>>> import time
>>> from email import Utils

>>> def tconv(t):
...     t1 = Utils.mktime_tz(Utils.parsedate_tz(t))
...     return time.ctime(t1 -(8*60*60)) + ' -0800'

>>> tconv('Thu, 15 Dec 2005 09:24:19 -0500')
'Thu Dec 15 06:24:19 2005 -0800'


Failing that,  google for "python converting timezones"

HTH :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051221/7d71cb9c/attachment.html>


More information about the Python-list mailing list