Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lager1/3c97fe7326beda068304be057205d7fd to your computer and use it in GitHub Desktop.
Save lager1/3c97fe7326beda068304be057205d7fd to your computer and use it in GitHub Desktop.
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
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment