In Python, how to display current time in readable format

后端 未结 6 1187
感情败类
感情败类 2020-12-07 18:15

How can I display the current time as:

12:18PM EST on Oct 18, 2010

in Python. Thanks.

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-07 18:43

    All you need is in the documentation.

    import time
    time.strftime('%X %x %Z')
    '16:08:12 05/08/03 AEST'
    

提交回复
热议问题