I need to convert a zope 2 DateTime object into a Python datetime object. What is the best way to do that? Thanks, Erika
views:
94answers:
3
+1
A:
modernthingy = datetime.datetime.fromtimestamp(zopethingy.timeTime())
The datetime
instance is timezone-naive; if you need to support timezones (as Zope2's DateTime
does), I recommend third-party extension package pytz.
Alex Martelli
2010-04-05 14:20:21
A:
Newer DateTime implementations (2.11 and up) have a asdatetime
method that returns a python datetime.datetime instance:
modernthingy = zopethingy.asdatetime()
Martijn Pieters
2010-04-05 15:59:40