开发者

PHPExcel: Date formatting difference between 1.7.4 and 1.7.6

开发者 https://www.devze.com 2023-04-07 16:07 出处:网络
I\'ve two different results with the same code between two PHPExcel versions (same server, same code, same data). I\'ve tried two ways to write in the cell, same behaviour.

I've two different results with the same code between two PHPExcel versions (same server, same code, same data). I've tried two ways to write in the cell, same behaviour.

PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
$sheet->getStyleByColumnAndRow($col,$i)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$sheet->setCellValueByColumnAndRow($col,$i,$myDate->format('Y-m-d'));
//Or this line:
//$sheet->setCellValueByColumnAndRow($col,$i,PHPExcel_Shared_开发者_如何转开发Date::stringToExcel($myDate->format('Y-m-d')));
$sheet->getStyleByColumnAndRow($col,$i)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH);

In 1.7.4 --> dd/mm/YYYY that's what i want In 1.7.6 --> YY/m/d uglyy !!!! What's wrong with my code ? Thanks for your help S.

0

精彩评论

暂无评论...
验证码 换一张
取 消