2 回答
TA贡献1818条经验 获得超8个赞
你可以这样做:
<?php
$date = "01-08-29";
$dates = DateTime::createFromFormat('m-d-y', $date);
$arr = $dates->format('m-d-Y');
echo $str2 = date('m-d-Y', strtotime('-36500 days', strtotime($arr))); //this will result in 08-26-1929
?>
TA贡献1804条经验 获得超3个赞
附加的代码将返回 PHP Date 对象,你很高兴
<?php
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load("test.xlsx");
$sheet = $spreadsheet->getSheet(0);
$cell = $sheet->getCell('B3');
$dateVal = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($cell->getValue());
?>
返回:
DateTime Object
(
[date] => 1929-08-02 00:00:00.000000
[timezone_type] => 3
[timezone] => UTC
)
- 2 回答
- 0 关注
- 526 浏览
添加回答
举报