Python 基礎(chǔ)教程
Python time strftime() 函數(shù)接收以時(shí)間元組,并返回以可讀字符串表示的當(dāng)?shù)貢r(shí)間,格式由參數(shù)format決定。
strftime()方法語(yǔ)法:
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 17 2009 09:03:38其他擴(kuò)展