如何将当前时间显示为:
12:18PM EST on Oct 18, 2010
在Python中。谢谢。
发布于 2010-10-19 01:36:56
首先是快速和肮脏的方法,其次是精确的方法(识别日光节约与否)。
import time
time.ctime() # 'Mon Oct 18 13:35:29 2010'
time.strftime('%l:%M%p %Z on %b %d, %Y') # ' 1:36PM EDT on Oct 18, 2010'
time.strftime('%l:%M%p %z on %b %d, %Y') # ' 1:36PM EST on Oct 18, 2010'
发布于 2010-10-19 01:21:07
您所需要的就是in the documentation。
import time
time.strftime('%X %x %Z')
'16:08:12 05/08/03 AEST'
发布于 2018-03-30 17:21:00
import time
time.strftime('%H:%M%p %Z on %b %d, %Y')
https://stackoverflow.com/questions/3961581
复制相似问题