Excel date conversion using PHP Excel

后端 未结 5 1044
予麋鹿
予麋鹿 2020-11-30 03:53

i am reading date from excel which is in this format 12/5/2012 day/month/year using this code to read . using PHP EXCEL

   PHPExcel_Style_NumberFormat::t         


        
5条回答
  •  春和景丽
    2020-11-30 04:44

    When using PHPExcel you can use the built in function:

    $excelDate = $cell->getValue(); // gives you a number like 44444, which is days since 1900
    $stringDate = \PHPExcel_Style_NumberFormat::toFormattedString($excelDate, 'YYYY-MM-DD');
    

提交回复
热议问题