[egenix-users] mxDateTime puzzle

M.-A. Lemburg mal at egenix.com
Fri May 2 13:37:33 CEST 2008

On 2008-05-02 11:29, Dick Moores wrote:
> Win XP, Python 2.5.1, mxDateTime v.3
> I'm trying to begin to master both Python's datetime module and
> mxDateTime. I have a script that does something useful for me with
> datetime: <http://py77.python.pastebin.com/f25c957>. Note the user is
> able to enter a date in informal U.S. style. E.g. yesterday's as
> 5/1/2008.
> I've tried hard to write a script that does the same with mxDateTime,
> but am not able to incorporate the same date style. I'm stuck at
> having the user enter a date as "year, month, date". This effort is at
> <http://py77.python.pastebin.com/f130055a1>
> Please suggest how to modify this to meet my objective.

 >>> from mx.DateTime import *
 >>> DateTimeFrom('5/1/2008')
<mx.DateTime.DateTime object for '2008-05-01 00:00:00.00' at 2af4247e1ce8>

DateTimeFrom() is a generic interface to parsers and other constructors
in mxDateTime.

For more flexible date/time parsing, have a look at the mx.DateTime.Parser

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, May 02 2008)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
            Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the egenix-users mailing list