I have two values, this value is hexadecimal-binary value. I need to convert into timestamp and get difference between two values. I tried many ways but not success. Can you please help me?
value1 = b'\x05\x03'
and value2 = b'c\xf3'
I tried this way:
import struct
data= type(b'\xb5B')
index1= 773
index2= 62307
date1 = bin(773)
date2= bytes(date1, 'ascii')
print(datetime.datetime.fromtimestamp(int(index1)).strftime('%Y-%m-%d %H:%M:%S'))
print(datetime.datetime.fromtimestamp(int(index2)).strftime('%Y-%m-%d %H:%M:%S'))
date1 = datetime.datetime.fromtimestamp(index1).strftime('%d-%m-%y -%h')
date2= datetime.datetime.fromtimestamp(index2)
unpacked, = struct.unpack('<Q', date2)
test= datetime.datetime(1601,1,1) + datetime.timedelta(microseconds=unpacked/10.)
print(test)
print(date2)