[Tutor] datetime.strptime not matching timezone in format

vishwajeet singh dextrous85 at gmail.com
Tue May 4 11:47:44 CEST 2010


Dear All,

I am trying to convert date string to datetime using datetime.strptime and
when there is timezone part in string conversion is throwing errors.

Here is what I am doing
string_date = somedate.strftime("%a, %d %b %Y %H:%M:%S %Z")

and than later in some other part of code
actual_date = datetime.strptime(string_date,"%a, %d %b %Y %H:%M:%S %Z")

I am getting following error for this conversion "*time data 'Tue, 04 May
2010 14:59:45 +05:30' does not match format '%a, %d %b %Y %H:%M:%S %Z'*"

All formats without timezone works perfectly fine.

-- 
Vishwajeet Singh
+91-9657702154 | dextrous85 at gmail.com | http://bootstraptoday.com
Twitter: http://twitter.com/vishwajeets | LinkedIn:
http://www.linkedin.com/in/singhvishwajeet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100504/63fc6e0f/attachment.html>


More information about the Tutor mailing list