I would like to create network timestamps in NT format.
I've been able to convert them to readable time with this function:
NetworkStamp = "\xc0\x65\x31\x50\xde\x09\xd2\x01"
def GetTime(NetworkStamp):
Ftime = int(struct.unpack('<Q',NetworkStamp)[0])
Epoch = divmod(Ftime - 116444736000000000, 10000000)
Actualtime = datetime.datetime.fromtimestamp(Epoch[0])
return Actualtime, Actualtime.strftime('%Y-%m-%d %H:%M:%S')
print GetTime(NetworkStamp)
Output:
(datetime.datetime(2016, 9, 8, 11, 35, 57), '2016-09-08 11:35:57')
Now I'd like to do the opposite, converting '2016/09/08 11:35:57'
sec to this format:
"\xc0\x65\x31\x50\xde\x09\xd2\x01"