การแปลง DateVale(excel) เป็น Date time ด้วย php
วิธีการแปลงค่า 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