[python-win32] PyTime
Robert Brewer
fumanchu at amor.org
Tue May 8 18:52:12 CEST 2007
Mark Hammond wrote:
> Your solution seems to be to simply construct a datetime
> object from the
> pywintypes time object by way of attributes - eg:
>
> >>> from win32com.client import Dispatch
> >>> import datetime
> >>> xl=Dispatch("Excel.Application")
> >>> d=xl.Range("A1").Value
> >>> datetime.datetime(d.year, d.month, d.day, d.hour,
> d.minute, d.second,
> d.msec)
> datetime.datetime(2065, 2, 3, 0, 0)
Argle bargle...#$%^&*
Wish I'd known about those attributes before I spent far too many hours
trying to extract them back from float(d) [1]. Yet another lesson in the
dangers of multiple documentation locations. Ah well, at least I learned
something about Jet and SQL server internals.
Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org
[1] http://projects.amor.org/geniusql/changeset/84
More information about the Python-win32
mailing list