I'm using http://phpexcel.codeplex.com in one of my project, and I have come into an issue. I want to write the time() value inside a cell, which I am doing with :
function writeTimeLine($objActiveSheet, &$lineNumber, $timeStart, $timeEnd, $duration, $category, $client, $date, $comment)
{
$objActiveSheet->setCellValue('A'.$lineNumber, PHPExcel_Shared_Date::PHPToExcel( $timeStart ));
$objActiveSheet->getStyle('A'.$lineNumber)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
}
The $objActiveSheet refers to $objPHPExcel->getActiveSheet()
And the result in Excel is:
20:27:39
When in real on the computer I'm testing it it's 16:27:39
So it's an issue with the timezone (I'm living in Eastern America which is -4). However, I'm including PHPExcel files after setting the default timezone with
date_default_timezone_set('America/New_York');
And even with an echo of the time() I do see the correct hour (16:27:39).
Is it a bug of PHPExcel or am I doing something wrong here?
Thanks for your help.