Python中標準模組datetime能夠將字串轉換為日期
from datetime import datetime
text = '2012-09-200%%)> d')
print(y)
z = datetime.now()
diff = z - y
. strftime(z, '%A %B %d, %Y') print(nice_z) datetime.strftime表現很差,下方自己寫一個函數
year_s, mon_s , day_s = s.split('-')
return datetime(int(year_s), int(mon_s), int(day_s))