以此格式获取日期时间并转换为4字节十六进制 [英] Getting a datetime in this format and converting to 4 byte hex
本文介绍了以此格式获取日期时间并转换为4字节十六进制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的日期是这个格式。
1999-12-31 09:00:00
哪些来自十六进制值:
F0C46C38
如何将上述格式的datetime值设置为4字节十六进制
我上面发布的值是互补的。第二个代码块中的十六进制是相反的。
How do you make the datetime value of the above format into a 4 byte hex? The values I posted above are complements to each other. The hex in the second code block is reversed.
谢谢!
推荐答案
386CC4F0(十六进制)== 946652400(dec)
946652400是1999-12-31 15:00:00 GMT的Unix时间戳。
386CC4F0(hex) == 946652400(dec)
946652400 is Unix timestamp for 1999-12-31 15:00:00 GMT.
import time
print hex(int(time.mktime(time.strptime('1999-12-31 15:00:00', '%Y-%m-%d %H:%M:%S'))) - time.timezone)
这篇关于以此格式获取日期时间并转换为4字节十六进制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文