Reputation: 428
I'm trying to convert
[16/Jan/2010:18:11:06 +0100] (common log format)
to a timestamp. How can I use strptime
to convert this?
time zone can be different from +0100
Upvotes: 1
Views: 741
Reputation: 85478
import time
log = '16/Jan/2010:18:11:06 +0100'
dt = time.strptime(log, '%d/%b/%Y:%H:%M:%S +0100')
Reference: http://docs.python.org/library/time.html#time.strptime
Python's timezone support is problematic and platform dependant.
See this post (see also its first part).
Upvotes: 2