On 7 Dez., 14:34, supercooper <[EMAIL PROTECTED]> wrote: > On Dec 7, 7:20 am, Dirk Hagemann <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > From a zone-file of a Microsoft Active Directory integrated DNS server > > I get the date/time of the dynamic update entries in a format, which > > is as far as I know the hours since january 1st 1901. > > For Example: the number 3566839 is 27.11.07 7:00. To calculate this in > > Excel I use this: > > ="01.01.1901"+(A1/24-(REST(A1;24)/24))+ZEIT(REST(A1;24);0;0) (put > > 3566839 in field A1 and switch the format of the result-field to the > > corresponding date-time format). > > > You might guess what I need now: I want to calculate this somehow in > > python. > > > Sorry, but I couldn't find anything in the module time or something > > else to get this calculated. > > > Does anyone know how to convert this time in python to something > > usable or how to convert this formula in python? > > > Thanks a lot and regards > > Dirk > > I think you want the xldate_as_tuple function in the xlrd module: > > http://www.lexicon.net/sjmachin/xlrd.htm > > It works like a champ for me: > > >>> import xlrd > >>> xlrd.xldate.xldate_as_tuple(38980,0) > > (2006, 9, 20, 0, 0, 0) > > > > chad!
Thanks so far, that comes close to a solution I think, BUT when I enter 3566985 instead of 38980 I get the following error: Traceback (most recent call last): File "test.py", line 20, in <module> print xlrd.xldate.xldate_as_tuple(3566985,0) File "C:\Python25\lib\site-packages\xlrd\xldate.py", line 75, in xldate_as_tuple raise XLDateTooLarge(xldate) xlrd.xldate.XLDateTooLarge: 3566985 Do I have to use another function of this module? My number is 2 digits shorter than yours. What is 38980 representing? Dirk -- http://mail.python.org/mailman/listinfo/python-list