Python Forum

Full Version: Convert ActiveDirectory timestamp into regular one. Arrow (solved)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone,

I try to convert the timestamp from active directory (accountExpires field)

132556896000000000 representing : 1/21/2021 12:00:00 AM Pacific Standard Time

Microsoft reference Wrote:This value represents the number of 100-nanosecond intervals since January 1, 1601 (UTC).

If possible, I would like to use arrow who work nice to work with dates/time

The simplest will be to convert the AD timestamp in "Arrow timestamp" first. But I don't know how is constructed the arrow timestamp :/ (I supposes unix time ? )
https://arrow.readthedocs.io/en/stable/

Any ideas ?
Nevermind I found Big Grin

If somebody is interested, let me know and i'll post an explanation.
Divide by 10000000, subtract 11644473600, and feed that in as a unix timestamp.

>>> arrow.get(132556896000000000/10000000 - 11644473600)
<Arrow [2021-01-21T08:00:00+00:00]>