I am trying to port a program of mine from running on the CPython interpreter to IronPython. The latest part that stumps me is where I use the datetime class from the datetime module. Here is what happens when I try to use the strptime function.
» from datetime import datetime
» dt = datetime.strptime("21/11/06 16:30", "%d/%m/%y %H:%M")
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'type' object has no attribute 'strptime'
»
Is there something I need to be aware of that makes datetime specially different in IronPython?
For no particular reason,
datetime.strptimewas missing until IronPython 2.7.1. If you’re stuck on an older version, you can usetime.strptimeinstead.