gpt4 book ai didi

python - 在 python 中转换 64 位 Windows 日期时间

转载 作者:行者123 更新时间:2023-11-28 19:45:58 24 4
gpt4 key购买 nike

我需要将 windows 十六进制 64 位(大端)日期时间转换为 python 中可读的内容?

例子'01cb17701e9c885a'

转换为“2010 年 6 月 29 日星期二 09:47:42 UTC”

如有任何帮助,我们将不胜感激。

最佳答案

看起来像 Win32 FILETIME值,其中:

Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).

转换:

from datetime import datetime,timedelta
dt = '01cb17701e9c885a'
us = int(dt,16) / 10
print(datetime(1601,1,1) + timedelta(microseconds=us))

输出:

2010-06-29 09:47:42.754210

关于python - 在 python 中转换 64 位 Windows 日期时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4869769/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com