1

$row['A'] contains 13/03/2019

PHPExcel_Shared_Date::ExcelToPHP(trim($row['A']));

return float value

But date() function in PHP takes int

date('Y-m-d',PHPExcel_Shared_Date::ExcelToPHP(trim($row['A'])));

so it return 0

var_dump(PHPExcel_Shared_Date::ExcelToPHP(trim($row['A'])));exit();

showing result :float(2087015296)

print_r(intval(PHPExcel_Shared_Date::ExcelToPHP(trim($row['A']))));exit();

showing result: 2087015296

print_r(date('Y-m-d',2087015296));exit();

showing result 2036-02-19

0

1 Answer 1

1

You need to convert $row['A'] data to php acceptable date format,

After that pass it directly to date() function to change it's format in your desired way

echo date('Y-m-d', strtotime(trim(str_replace('/','-',$row['A']))));

Output:-https://3v4l.org/beUIG

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.