Simply convert 5 digit number in mysql database to a date

后端 未结 2 762
死守一世寂寞
死守一世寂寞 2021-01-21 18:03

I have been looking all over the web for this answer but dont understand all the things that were written. I try to do the from unix_timestamp() but it returns the wrong date. W

2条回答
  •  耶瑟儿~
    2021-01-21 18:11

    Try This

            $date_format = floor($excelDateTime);
            $time_format = $excelDateTime - $date_format;
            $mysql_strdate = ($date_format > 0) ? ( $date_format - 25569 ) * 86400 + $time_format * 86400 :    $time_format * 86400;
            $mysql_date_format = date("Y-d-m", $mysql_strdate);
    

提交回复
热议问题