[IronPython] Bug in time.strptime?

Mike Raath raathm at gmail.com
Tue Jul 4 19:23:00 CEST 2006


Just wondering if this post slipped in under the radar - can anyone please
confirm whether this is a bug, or if I could be using IronPython differently
to achieve the same thing?

I need to be able to interpret non-standard dates (the format of which I
can't dictate) and in CPython this is possible using the code below.

Thanks,
Mike

I'm getting an exception in IronPython which I don't get in CPython.
>
> From the CPython console window:
>
> >>> import time, datetime
> >>> d = time.strptime("July 3, 2006 At 0724 GMT", "%B %d, %Y At %H%M GMT")
>
> >>> print d
> (2006, 7, 3, 7, 24, 0, 0, 184, -1)
>
>
> From IronPython, a similar set of statements:
>
> engine.Execute("import datetime")
> engine.Execute("d = time.strptime(""July 3, 2006 At 0724 GMT"", ""%B %d,
> %Y At %H%M GMT"")")
>
> results in this exception:
> The string was not recognized as a valid DateTime. There is a unknown word
> starting at index 13.
>
>
>
> The word starting at index 13 is the "At" but the format string provided
> should tell strptime how to interpret it.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060704/a84823fe/attachment.html>


More information about the Ironpython-users mailing list