creating a datetime.datetime from an XML xs:dateTime
M.-A. Lemburg
mal at egenix.com
Tue Jan 6 08:31:52 EST 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/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/
More information about the Python-list
mailing list