python - 谁能告诉我为什么我在 python 中使用 gmtime 和 mktime 得到错误的结果?

标签 python

我使用python的time模块来转换time_struct和时间戳:

mktime(gmtime(1404144000))

结果是:

1404115200.0

谁能告诉我为什么?

最佳答案

mktime()localtime() 的倒数,而不是 gmtime()

要获取 gmtime() 的倒数,请参阅以下问题: Is there an inverse function for time.gmtime() that parses a UTC tuple to seconds since the epoch?

关于python - 谁能告诉我为什么我在 python 中使用 gmtime 和 mktime 得到错误的结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25160171/

相关文章:

Python Pandas - 在条件之间合并

python - Pandas 按组删除前导零值

python - 将 pygame 2d 水波纹转换为 pyOpenGL

python - 将其他文件中的函数添加到 Python 类中

python - 为什么 join 内置函数对我的代码没有影响?

python - Flask/Jinja2 - 包含相对于当前模板的模板

python - 如何检查模块属性是否为类

python - 删除一系列 csv 列

python - (Discord.py) 固定消息

python - Python 类的最大方法数是多少?