Skip to content.

Etria Lists

 

[quills-dev] [Collective-checkins] r49995 - quills.remoteblogging/trunk/quills/remoteblogging/browser

Raphael Ritz r.ritz at biologie.hu-berlin.de
Mon Sep 24 08:50:16 UTC 2007


quills-dev at lists.etria.com wrote:
> Author: tomster
> Date: Sun Sep 23 22:19:20 2007
> New Revision: 49995
>

[..]

> 
> i couldn't find any documentation on how to convert xmlrpc.DateTime into DateTime.DateTime 

FWIW

Python 2.4.4 (#2, Apr 12 2007, 21:03:11)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> from xmlrpclib import DateTime as xdt
 >>> from time import strptime
 >>> from datetime import datetime
 >>> xmlrpcdt = xdt()
 >>> xmlrpcdt
<DateTime '20070924T10:44:06' at -482578f4>
 >>> str(xmlrpcdt)
'20070924T10:44:06'
 >>> datetimedt = datetime(*strptime(str(xmlrpcdt),"%Y%m%dT%H:%M:%S")[0:6])
 >>> datetimedt
datetime.datetime(2007, 9, 24, 10, 44, 6)
 >>> str(datetimedt)
'2007-09-24 10:44:06'
 >>>


Getting from Python's datetime objects to Zope's DateTime
is left as an easy exercise ;-)

Raphael



More information about the quills-dev mailing list