gpt4 book ai didi

python - 如何在 python 中将 1970 年之前的日期转换为纪元?

转载 作者:行者123 更新时间:2023-12-04 15:16:44 25 4
gpt4 key购买 nike

<分区>

如何在 Python 3.x 中将 1970 年之前的日期转换为纪元?

相反方向给出了很多例子,其中一个具有负的纪元值并使用timedelta获取日期。但是,我找不到我们拥有真实日期时间并希望获得纪元时间戳的示例。

例如我正在做以下事情:

timestamp = datetime.datetime(1964, 12, 1, 0, 0).timestamp()

这给了我“OSError: [Errno 22] Invalid argument”

(我想这样做的原因是编辑扫描图片的创建日期,使其反射(reflect)曝光时间,而不是扫描日期。)

我的确切设置:Windows x64Python 3.7

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