PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.2k forks source link

Issue getting the timestamp #1365

Open Anabantha opened 6 years ago

Anabantha commented 6 years ago

Hi, my issue is when the library gets the timestamp of a date, PHPExcel gets it wrong. For example, my date is "08/11/17 15:28 PM" as soon as the conversion is made I get "2036-02-17 06:28:16", I know that the problem is the prefix AM / PM, but unfortunately that format can't be modified because the data collection have more than 20,000 rows and it's impossible edit row by row if in some cases the date format is "mm/d/yyy h:mm" or "mm/d/yy hh:mm AM/PM". How can I solve it?

At the moment my code to get the timestamp is: $EST_timestamp = $objPHPExcel->getActiveSheet()->getCell('W'.$i)->getValue(); $timestamp = PHPExcel_Shared_Date::ExcelToPHP($EST_timestamp); $EST_timeStamp = date("Y-m-d H:i:s",$timestamp);