In Python, how to display current time in readable format

后端 未结 6 1179
感情败类
感情败类 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:49

    By using this code, you'll get your live time zone.

    import datetime
    now = datetime.datetime.now()
    print ("Current date and time : ")
    print (now.strftime("%Y-%m-%d %H:%M:%S"))
    

提交回复
热议问题