How to convert zodb object datetime to Python?

72 Views Asked by At

Below is my the dictionary object after converting the DateTime broken object

{'_amon': 'Apr', '_aday': 'Mon', '_hour': 10, '_pmon': 'Apr.', '_fmon': 'April', '_pday': 'Mon.', '_fday': 'Monday', '_pm': 'am', '_t': 1428915860.996431, '_minute': 4, '_micros': 1428915860996431L, '_d': 41740.37802079203, '_nearsec': 20.0, '_tz': 'GMT+1', '_month': 4, '_timezone_naive': False, '_pmhour': 10, '_year': 2015, '_second': 20.996431, '_day': 13, '_dayoffset': 1, 'time': 0.37802079202811}

I am unable to convert the object in DateTime format.

1

There are 1 best solutions below

2
jxddk On

Read the documentation here

from DateTime import DateTime
zope_DT = DateTime() # this is now.
python_dt = zope_DT.asdatetime() # ZODB DateTime to Python Datetime