It would be great if you could convert PyTimes directly to datetime objects.
It would be even nicer if they *were* datetime objects, but that's a big change...
I'm currently working on allowing datetime.datetime objects to be used
in place of PyTime. I've also run into the issue noted in bug #2209864
with fractional second truncation when converting variant DATEs.
There's also a large performance hit, since PyTime stores the value
internally as a DATE (really a double), meaning it doesn't have to be
converted back to a float. However, passing a datetime to/from COM becomes
really expensive, since it will have to be converted not only
on output, but each and every time it's passed to a function that
needs a DATE.
I'm considering trying to subclass datedate.datetime so we can also store
the variant DATE with it, but haven't looked at it too deeply yet.
In Python 2.3 datetime is pure python, but in 2.4 and up it's a
builtin implemented in C, which may or may not support subclassing.
The capability to convert PyTimes to datetime already exists:...
>>> import adodbapi
>>> tc = adodbapi.pythonDateTimeConverter()
>>> d = tc.DateObjectFromCOMDate(37435.7604282)
datetime.datetime(2002, 6, 28, 18, 15, 0, 996480)
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.