如何获得python当前时间?

这个问题在这里已经有了答案:

  • 如何在Python中获取当前时间? 27个答案

  •     import time
    
        now = time.strftime("%c")
    

    详情请参阅https://www.cyberciti.biz/faq/howto-get-current-date-time-in-python/


    from time import gmtime, strftime
    strftime("%a, %d %b %Y %H:%M:%S", gmtime())
    
    # Will output
    'Thu, 03 May 2017 16:21:01'
    

    为你的例子使用:

    from time import gmtime, strftime
    strftime("%y-%d-%mT%H:%M:%SZ", gmtime())
    2017-03-05T07:34:35Z
    
    链接地址: http://www.djcxy.com/p/40907.html

    上一篇: How to get on python current time?

    下一篇: time string into a specific time zone