最近在最PHP导出EXcel文件时,日期出现类似41395的问题,
只要写一个方法就可以了。
方法如下:
function exceltimtetophp($days,$time=false)
{
if(is_numeric($days))
{
$jd = GregorianToJD(1, 1, 1970);
$gregorian = JDToGregorian($jd+intval($days)-25569);
$gregorian = strtotime($gregorian);
$gregorian = date("Y年m月d日",$gregorian);
// $myDate = explode('\\',$gregorian);
// $myDateStr = str_pad($myDate[2],4,'0', STR_PAD_LEFT)."-".str_pad($myDate[0],2,'0',STR_PAD_LEFT)."-".str_pad($myDate[1],2,'0', STR_PAD_LEFT).($time?"00:00:00":'\\');
return $gregorian;
}
return $time;
}