Skip to content

Commit 52071e9

Browse files
author
MarkBaker
committed
ODS Reader should also use the new Method for date values
1 parent ef4029d commit 52071e9

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

src/PhpSpreadsheet/Reader/Ods.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace PhpOffice\PhpSpreadsheet\Reader;
44

5-
use DateTime;
65
use DOMAttr;
76
use DOMDocument;
87
use DOMElement;
@@ -478,21 +477,7 @@ public function loadIntoExisting($filename, Spreadsheet $spreadsheet)
478477
case 'date':
479478
$type = DataType::TYPE_NUMERIC;
480479
$value = $cellData->getAttributeNS($officeNs, 'date-value');
481-
482-
$dateObj = new DateTime($value);
483-
[$year, $month, $day, $hour, $minute, $second] = explode(
484-
' ',
485-
$dateObj->format('Y m d H i s')
486-
);
487-
488-
$dataValue = Date::formattedPHPToExcel(
489-
(int) $year,
490-
(int) $month,
491-
(int) $day,
492-
(int) $hour,
493-
(int) $minute,
494-
(int) $second
495-
);
480+
$dataValue = Date::convertIsoDate($value);
496481

497482
if ($dataValue != floor($dataValue)) {
498483
$formatting = NumberFormat::FORMAT_DATE_XLSX15

0 commit comments

Comments
 (0)