python时间戳数字转为字符串格式表达
import datetime def getdate(date): s_date = datetime.date(1899, 12, 31).toordinal() - 1 if isinstance(date, float): date = int(date) d = datetime.date.fromordinal(s_date + date) return d.strftime("%Y-%m-%d") print getdate(41400.0)
输出:2013-05-06