>>> from datetime import datetime, timedelta
>>> def convert_ad_timestamp(timestamp):
... epoch_start = datetime(year=1601, month=1,day=1)
... seconds_since_epoch = timestamp/10**7
... return epoch_start + timedelta(seconds=seconds_since_epoch)
...
>>> convert_ad_timestamp(129410017915727600)
datetime.datetime(2011, 2, 1, 2, 43, 11)
>>> convert_ad_timestamp(129410017915727600).strftime("%y-%m-%d %H:%M")
'11-02-01 02:43'
Time in Python
Active Directory / LDAP Python Timestamp converter
Subscribe to:
Posts (Atom)