pywintypes pytime object

Yoon S. Choi ychoi at pipeline.com
Mon May 15 13:12:50 EDT 2000


I have a COM object that takes the win32 type DATE as a parameter
for one of its function calls. 

I am trying to call this function from Python, but I am having some
trouble passing in dates that are older than January 1, 1970 and newer
than the year 2038.  That is because pywintypes pytime object is based
C ctime mechanism whose epoch begins in 1970.  

Is there any way of sending a proper date to a COM object that expects
the DATE type without having to use the pytime object?

DATE's epoch begins in 1899 and counts the number of days since that
epoch.  DATE is implemented as a float.  I tried passing in a float
but it seems Python was not smart enough to translate it into the
proper format for COM.

I tried using Mark Lemburg's DateTime module.  But I am still
inherently limited by the fact that Python will only accept the pytime
object as a parameter to a COM object that expects a DATE.  



More information about the Python-list mailing list