Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: [2.4.4] creating a datetime.datetime from an XML xs:dateTime

Reply
Thread Tools

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

 
 
skip@pobox.com
Guest
Posts: n/a
 
      12-27-2008

martin> is that http://labix.org/python-dateutil, I'll have a look at
martin> it.

Yup. PyPI:

http://pypi.python.org/pypi/python-dateutil/1.4.1

Skip
 
Reply With Quote
 
 
 
 
Jack.Chu
Guest
Posts: n/a
 
      12-29-2008
I think a simple regular expression is a relatively easy solution.
 
Reply With Quote
 
 
 
 
M.-A. Lemburg
Guest
Posts: n/a
 
      01-06-2009
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/pytho...se/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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Print XML parsing to JspWriter (out) Class org.xml.sax.helpers.NewInstance can not access a member of class javax.xml.parsers.SAXParser with modifiers "protected" Per Magnus L?vold Java 0 11-15-2004 02:27 PM
embedding xml in xml as non-xml :) Mark Van Orman XML 5 09-15-2004 05:57 AM
What XML technologies to learn first for "XML Processing" and "XML Mapping"? Bomb Diggy Java 0 07-28-2004 07:26 AM
Help on including one XML document within another XML document using XML Schemas Tony Prichard XML 0 12-12-2003 03:18 PM



Advertisments