如何逆向gmtime()
,把时间+日期放在哪里,得到秒数?
我有类似 'Jul 9, 2009 @ 20:02:58 UTC'
之类的字符串,我想返回 epoch 和 2009 年 7 月 9 日之间的秒数。
我已经尝试过time.strftime
,但我不知道如何正确使用它,或者它是否是正确的命令。
最佳答案
使用 time模块:
import time
epoch_time = int(time.time())
https://stackoverflow.com/questions/4548684/