0

I wanted to customize date in phpspreadsheet.

Feb 10, 2019 11:34:04

That's the default format but I wanted to add PM or AM at the end.

Is there any way to customize date format in phpspreadsheet? These two aren't working.

$sheet->getStyle($cell)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_TIME1);

$sheet->getStyle($cell)->getNumberFormat()->setFormatCode('MMM dd,yyyy hh:mm:ss aa');       
silent_coder14
  • 583
  • 2
  • 10
  • 38
  • https://stackoverflow.com/questions/47883697/phpspreadsheet-setformatcode-not-working Hope this helps! – K.Raj. Feb 11 '19 at 08:48

1 Answers1

0

You can use :

$birthday = date("d/m/Y", strtotime($birthday));
$sheet->getActiveSheet()->setCellValue('A'.$numRow, $birthday);
TuChiDo
  • 53
  • 5