联系我们:416326801#qq.com(#改成@)

img1

PHP导入Excel时间格式转换

1349 Views 标签: PHP Excel

public static function excelTime($date, $time=false){
        if(is_numeric($date)) {
                $jd = GregorianToJD(1, 1, 1970);
                $gregorian = JDToGregorian($jd+intval($date)-25569);
                $date = explode('/',$gregorian);
                $date_str = str_pad($date[2],4,'0', STR_PAD_LEFT)
                ."-".str_pad($date[0],2,'0', STR_PAD_LEFT)
                ."-".str_pad($date[1],2,'0', STR_PAD_LEFT)
                .($time?" 00:00:00":'');
                return $date_str;
        }
        return $date;
}

如果觉得我的文章对您有用,打赏一下呗.

wxpay.png