read date format

Topics: Developer Forum, Project Management Forum, User Forum
Feb 1, 2010 at 9:36 AM
Edited Feb 1, 2010 at 9:37 AM

When I read a date ('10/01/16') from a cell, the value I get for this cell is nothing.

This is obviously not working, I must be doing something really stupid here, but I can't seem to figure out what.

I use PHPExcel version 1.7.1


The code I use to read the date from the cells is the following

$cellValue = $currentSheet->getCell($cellIndex)->getValue();


The code I use to write the data to cells is the following

include 'common/excelclasses/PHPExcel/Cell/AdvancedValueBinder.php';

PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );

$objPHPExcel->getActiveSheet()->setCellValue($cellStartStr, $paperDataValue[$i]);

                        $objPHPExcel->getActiveSheet()->getStyle($cellStartStr)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH);PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );$objPHPExcel->getActiveSheet()->setCellValue($cellStartStr, $paperDataValue[$i]);$objPHPExcel->getActiveSheet()->getStyle($cellStartStr)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH);


So... can someone please explain how I can receive the proper value?

Feb 5, 2010 at 12:20 AM

Can you check if this thread helps for reading the date?

Apr 12, 2012 at 8:55 PM


for me i used this instruction du get a correct value :

$sheet = $objPHPExcel->getSheet(0);

            $data=$sheet->getCellByColumnAndRow($col, $i)->getFormattedValue();   
            print $data;