zoukankan      html  css  js  c++  java
  • [Tips] python time模板的时间格式

    在import time模块后,可以获得各种格式的时间输出。

    典型的过程如下:

    import time
    #获得当前时间时间戳,下面now的int数值就是时间戳
    now = int(time.time())
    #转换为其他日期格式,如:"%Y-%m-%d %H:%M:%S"
    timeArray = time.localtime(now)
    otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
    

      

    上面获得otherStyleTime就是根据需要的日期格式转换好的时间字符串。

  • 相关阅读:
    第二章初识MySQL
    第一章 数据库
    Java&SQL7
    Java&SQL
    Java&SQL6
    Java&SQL5
    Java&SQL4
    Java&SQL3
    Java&SQL2
    博客地址已搬迁
  • 原文地址:https://www.cnblogs.com/immortalBlog/p/12869503.html
Copyright © 2011-2022 走看看