[Tutor] datetime.strptime not matching timezone in format
Abhishek Mishra
ideamonk at gmail.com
Tue May 4 12:47:31 CEST 2010
%Z stands for time zone name in letters Eg. IST or EDT or GMT, so it would
fail to parse +05:30
However I do not have a solution to your problem but a footnote as hint -
http://docs.python.org/library/time.html#id1
-- Abhishek
On Tue, May 4, 2010 at 3:17 PM, vishwajeet singh <dextrous85 at gmail.com>wrote:
> 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
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100504/ad86fb9d/attachment.html>
More information about the Tutor
mailing list