W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
Python time strftime() 函數(shù)接收以時(shí)間元組,并返回以可讀字符串表示的當(dāng)?shù)貢r(shí)間,格式由參數(shù)format決定。
strftime()方法語法:
time.strftime(format[, t])
返回以可讀字符串表示的當(dāng)?shù)貢r(shí)間。
python中時(shí)間日期格式化符號(hào):
以下實(shí)例展示了 strftime() 函數(shù)的使用方法:
#!/usr/bin/python
import time
t = (2009, 2, 17, 17, 3, 38, 1, 48, 0)
t = time.mktime(t)
print time.strftime("%b %d %Y %H:%M:%S", time.gmtime(t))
以上實(shí)例輸出結(jié)果為:
Feb 18 2009 00:03:38
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: