Last active
March 4, 2021 03:16
-
-
Save caot/f57fbf419d6b37d53f6f4a525942cafc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
def to_timestamp(timestamp): | |
timestamp = float(timestamp[0]) | |
seconds_since_epoch = timestamp/10**7 | |
loc_dt = datetime.fromtimestamp(seconds_since_epoch) | |
loc_dt -= timedelta(days=(1970 - 1601) * 365 + 89) | |
return loc_dt | |
pwdLastSet = result['pwdLastSet'] | |
print pwdLastSet | |
pwdLastSet_2 = convert_ad_timestamp(pwdLastSet) | |
print pwdLastSet_2.strftime("%m/%d/%y %H:%M:%S") | |
print pwdLastSet_2.strftime("%m/%d/%y %I:%M:%S.%f %p") | |
''' | |
['131439375892061415'] | |
07/07/17 17:46:29 | |
07/07/17 05:46:29.206141 PM | |
''' |
I'm a random guy, but thanks for the function !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.epochconverter.com/ldap
PS F:> w32tm.exe /ntte 131439375892061415
152128 21:46:29.2061415 - 7/7/2017 5:46:29 PM