G
G
German Zuiakov2021-07-24 21:41:41
PHP
German Zuiakov, 2021-07-24 21:41:41

How to transfer date from excel to mysql?

I use the PHPExcel library to import from XLS, the problem is that when importing the date data type in Excel (10/20/2020), it translates to an incomprehensible year, if the data type is set to varchar, it translates to 44114, when using date(), shows 01/01/1970

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Belyaev, 2021-07-25
@HermanZuiakov

The library is no longer maintained, instead PhpSpreadsheet from the same developers.
I myself patched this PHPExcel a hundred times at home, then the cell styles are not applied, what else.
44114 is clearly only 12 hours from the beginning of Unix Time, don't use date here, it's not a timestamp, it's an Excel format.
Use something like
->getCell('I5')->getFormattedValue()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question