/** * 时间格式处理 * @param $days * @param bool $time * @return string */public 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;} 注意:如果linux没有安装类库:http://php.net/manual/zh/calendar.installation.php
原文地址:https://www.cnblogs.com/taikongliu/p/8243600.html
时间: 2024-11-09 03:05:28