parse date string having "EDT"

Tim Roberts timr at probo.com
Tue Jun 21 01:52:58 EDT 2011


Junaid P V <junu.pv at gmail.com> wrote:
>
>I was trying to parse a date string containing "EDT" time zone
>
>eg: 'Mon Jun 20 14:00:57 EDT 2011'
>
>I tried:
>
>datetime.strptime('Mon Jun 20 14:00:57 EDT 2011', '%a %b %d %H:%M:%S %Z %Y')
>
>But I get error

Right, because strptime doesn't support %Z.  You'll have to handle that
yourself and remove it before conversion.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list