Create pywintypes.Time from an mx.DateTime.DateTime

Mike Weiss WeissMike at hotmail.com
Fri May 24 08:44:17 EDT 2002


I'm *very* new to python (C++ programmer)  so please bear with me if
what
I'm asking is completely stupid.
I'm using both mxDateTime and the win32 extensions in python v2.2.

I'm trying to create a pywintypes.Time (a window's COM date (right?))
FROM
an mx.DateTime object. I can go the other way (pywintypes TO
mxDateTime).

mx.DateTime.COMDate() returns a float, which I can't seem to use to
initalize a pywintypes.Time object with. Pywintypes.Time only seems to
be
able to be created from the integer value used by the basic "time"
module in standard python. The basic Python date's 1970 to 2038
year-limits make using a
"time" object not at all not possible for me.

example:
import pywintypes, types, mx.DateTime

mxtime = mx.DateTime.Date(2050)
print mxtime.Format() #prints "01/01/50 00:00:00" which is right

comtime = pywintypes.Time(mxtime.COMDate())
print comtime.Format() #prints "01/01/70 10:13:09" Not right!



More information about the Python-list mailing list