Hi,
I have a CSV dumpfile from a Blackberry IPD backup, created using IPDDump.
The date/time strings in here look something like this
(where EST
is an Australian time-zone):
Tue Jun 22 07:46:22 EST 2010
I need to be able to parse this date in Python. At first, I tried to use the strptime()
function from datettime.
>>> datetime.datetime.strptime('Tue Jun 22 12:10:20 2010 EST', '%a %b %d %H:%M:%S %Y %Z')
However, for some reason, the datetime
object that comes back doesn't seem to have any tzinfo
associated with it.
I did read on this page that apparently datetime.strptime
silently discards tzinfo
, however, I checked the documentation, and I can't find anything to that effect documented here.
I have been able to get the date parsed using a third-party Python library, dateutil, however I'm still curious as to how I was using the in-built strptime()
incorrectly? Is there any way to get strptime()
to play nicely with timezones?
Cheers,
Victor