[python-win32] PyTime

Francesco Guerrieri f.guerrieri at gmail.com
Tue May 8 16:52:37 CEST 2007


On 5/8/07, Mark Hammond <mhammond at skippinet.com.au> 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)



thanks,
the docs didn't explicitly cite the existance of those attributes... However
I (mistakenly) thought of having tried to use them. It's evident that I
hadn't tried correctly :-)

Now the code is much more readable :-)
Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20070508/a34ecd18/attachment.htm 


More information about the Python-win32 mailing list