美文网首页
python 时间转换成时间戳

python 时间转换成时间戳

作者: WangLane | 来源:发表于2019-04-19 19:36 被阅读0次

    时间转换成时间戳

    s = 'Fri Apr 26 22:35:25 +0800 2019'
    ts = datetime.datetime.strptime(s, "%a %b %d %H:%M:%S %z %Y")
    ts = int(ts.timestamp())
    # 1556289325
    
    常用格式符
    常用格式符(续表)

    相关文章

      网友评论

          本文标题:python 时间转换成时间戳

          本文链接:https://www.haomeiwen.com/subject/gjbvwqtx.html