Re: [2.4.4] creating a datetime.datetime from an XML xs:dateTime

Discussion in 'Python' started by skip@pobox.com, Dec 27, 2008.

  1. Guest

    , Dec 27, 2008
    #1
    1. Advertising

  2. Jack.Chu Guest

    Re: creating a datetime.datetime from an XML xs:dateTime

    I think a simple regular expression is a relatively easy solution.
     
    Jack.Chu, Dec 29, 2008
    #2
    1. Advertising

  3. Re: creating a datetime.datetime from an XML xs:dateTime

    On 2008-12-29 05:26, Jack.Chu wrote:
    > I think a simple regular expression is a relatively easy solution.


    Or use mxDateTime and let the parser do all the heavy lifting
    for you:

    >>> from mx.DateTime import Parser
    >>> t = Parser.DateTimeFromString('2000-01-12T12:13:14Z')
    >>> t

    <mx.DateTime.DateTime object for '2000-01-12 12:13:14.00' at 2b5c19c03500>
    >>> t = Parser.DateTimeFromString('2000-01')
    >>> t

    <mx.DateTime.DateTime object for '2000-01-01 00:00:00.00' at 2b5c18fa12f0>
    >>> t = Parser.DateTimeFromString('2000-01-12')
    >>> t

    <mx.DateTime.DateTime object for '2000-01-12 00:00:00.00' at 2b5c19c03500>

    http://www.egenix.com/products/python/mxBase/mxDateTime/

    --
    Marc-Andre Lemburg
    eGenix.com

    Professional Python Services directly from the Source (#1, Jan 06 2009)
    >>> 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 our new mxODBC.Connect Python Database Interface 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
    http://www.egenix.com/company/contact/
     
    M.-A. Lemburg, Jan 6, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    764
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    602
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    442
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    377
    Martin
    Dec 27, 2008
  5. NiklasRTZ

    datetime.datetime. or datetime. ?

    NiklasRTZ, Oct 8, 2009, in forum: Python
    Replies:
    10
    Views:
    566
    niklasr
    Oct 11, 2009
Loading...

Share This Page