PHPExcel
PHPExcel copied to clipboard
Reading from Excel and change date format
Hello, please help me. I read data from XLSX file. I get array, that contains datetime in format 31.10.2015 Into Excel file is save values as 31.10.2015.
Please, How Can I get date format 2015-10-31?
Have to I set anything in MS Excel file?
I try it with this code but can not.
$sheetData = $objPHPExcel->getActiveSheet() // Format as date and time
->getStyle('M:N')
->getNumberFormat()
->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
Thank you for your help
Thanks for the ->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
example. Thats what i needed.
I know this is old, but you might need to make sure you set in your start and end rows
->getStyle($colLetter . $startRow . ':' . $colLetter . $endRow)