Converting Excel time-format (hours since 1.1.1901)

Giles Brown giles_brown at hotmail.com
Fri Dec 7 10:18:44 EST 2007


On 7 Dec, 13:20, Dirk Hagemann <DirkHagem... at gmail.com> 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

Something is a bit off here...

"""
>>> import datetime
>>> timezero=datetime.datetime(1901, 1, 1)
>>> timezero+datetime.timedelta(hours= 3566839)
datetime.datetime(2307, 11, 27, 7, 0)
"""

Giles



More information about the Python-list mailing list