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