วิธีการแปลงค่า Datetime เป็นค่า Datevale ด้วย PHP เนื่องจาก Excel สามารถเปลี่ยน datetime เป็นค่าตัวเลขได้เลยแต่ php ไม่ได้สามารถทำได้ ทำได้เพียงเปลี่ยนเป็น unixtime ด้วยคำสั่ง strtotime() เท่านั้น วิธีนี้สามารเอา unixtime แปลงเป็นค่า datevalue เหมือนในExcel ให้สามารถแปลงค่าได้เหมือนกับสูตรใน excel ได้
##############
ตัวอย่าง Code
$get_datetime=”13/8/2016 11:22″;
$datetime=str_replace(“/”,”-“,$get_datetime);
$fix_value=25569;
echo $fix_value+(strtotime($datetime)/86400);

Please use this formula to change from Excel date to Unix date, then you can use “gmdate” to get the real date in PHP:
UNIX_DATE = (EXCEL_DATE - 25569) * 86400
and to convert from Unix date to Excel date, use this formula:
EXCEL_DATE = 25569 + (UNIX_DATE / 86400)
After putting this formula into a variable, you can get the real date in PHP using this example:
$UNIX_DATE = ($EXCEL_DATE - 25569) * 86400;
echo gmdate("d-m-Y H:i:s", $UNIX_DATE);
Ref1 : https://stackoverflow.com/questions/11119631/excel-date-conversion-using-php-excel
Ref2 : http://iphpdev.blogspot.com/2017/01/convert-datevalue-in-excel-from-php.html?m=1