[IronPython] datetime.strptime is missing in IronPython?

Ken MacDonald drken567 at gmail.com
Mon Jun 7 13:12:17 PDT 2010


Hi Peter,
I just did this myself; starting with the times that I parsed out from a
TextBox, plus the yr/mo/day values from 'now':
        from System import DateTime    *<== note: DateTime not datetime*
        new_time = DateTime(yr, mo, day, self.hh, self.mm, self.ss)

I did find some other ways to do this by googling, but this worked nicely
for me as I had already parsed/validated the TextBox time; I did also find
some suggestion that strptime might appear in a future release.... how
future, I can't say. Good luck!
Ken


On Mon, Jun 7, 2010 at 3:56 PM, Peter Masiar <peter.masiar at gmail.com> wrote:

> Seems like datetime in Ironpython has only strftime, but no strptime?
>
> IronPython 2.0.3 (2.0.0.0) on .NET 2.0.50727.3603
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import datetime
> >>> dir(datetime.datetime)
> ['CompareTo', '__add__', '__class__', '__delattr__', '__doc__', '__eq__',
> '__ge_
> _', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__init__',
> '__l
> e__', '__lt__', '__ne__', '__new__', '__nonzero__', '__radd__',
> '__reduce__', '_
> _reduce_ex__', '__repr__', '__rsub__', '__setattr__', '__str__', '__sub__',
> 'ast
> imezone', 'combine', 'ctime', 'date', 'day', 'dst', 'fromordinal',
> 'fromtimestam
> p', 'hour', 'isocalendar', 'isoformat', 'isoweekday', 'max', 'microsecond',
> 'min
> ', 'minute', 'month', 'now', 'replace', 'resolution', 'second', 'strftime',
> 'tim
> e', 'timetuple', 'timetz', 'today', 'toordinal', 'tzinfo', 'tzname',
> 'utcfromtim
> estamp', 'utcnow', 'utcoffset', 'utctimetuple', 'weekday', 'year']
> >>>
>
> Or do I have wrong/obsolete IronPython? Which one has datetime.strptime()?
> What I am missing?
>
> What is recommended way in IronPython to parse date/time string back
> to date object?
>
> Thanks!
> --
> -----
> Peter Masiar
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20100607/5d1fa4f9/attachment.htm>


More information about the Users mailing list