Parsing Time String with Timezone info
Posted on 2007-03-23
I'm trying to parse Apache log files with Python and I'm having difficulty parsing the time zone information.
t = "23/Mar/2007:02:01:14 -0500"
pdate = time.strptime(t, "%d/%b/%Y:%H:%M:%S %Z")
The above code fails. How can I take the above string and parse it to get a unix timestamp in GMT? I looked at mx.DateTime but the parser documentation didn't seem to say anything about timezone information. Does mx.DateTime handle this correctly or do I need something different?