Excel date conversion using PHP Excel

后端 未结 5 1053
予麋鹿
予麋鹿 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:37

    It appears your variable is a string, or is expecting a US format date.
    use 'DateTime::createFromFormat' to cast the date into an actual date format

    $date = DateTime::createFromFormat('d/m/y', $value['A']);
    echo $date->format('Y-m-d');
    

提交回复
热议问题