/** * [excelTime description] * @Author:XuXianGang * @Method:excel 转换时间 * @DateTime:2022-06-06T09:36:37+0800 * @param [type] $days [description] * @param boolean $time [description] * @return [type] [description] */ function excelTime($days, $time=false){ if(is_numeric($days)){ //based on 1900-1-1 $jd = GregorianToJD(1, 1, 1970); $gregorian = JDToGregorian($jd+intval($days)-25569); $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 $myDateStr; } return $days; }
# 调用方式 $t = "44972"; $this->excelTime($t);
标签:00,description,excel,myDate,days,导入,pad,php From: https://www.cnblogs.com/xiangangXu1997/p/17150177.html