use*_*776 1 php phpspreadsheet
再会。我使用 PhpSpreadsheet 的库来导入 xlsx。
在 xlsx 中的 I 列中,我有这个值20/10/1970 00:00:00显示,1970-10-20 00:00:00但是当我导入它时:
$dataArray = $spreadsheet->getActiveSheet()
->rangeToArray(
    'A2:AO3',    // The worksheet range that we want to retrieve
    NULL,        // Value that should be returned for empty cells
    NULL,        // Should formulas be calculated (the equivalent of getCalculatedValue() for each cell)
    TRUE,        // Should values be formatted (the equivalent of getFormattedValue() for each cell)
    TRUE         // Should the array be indexed by cell row and cell column
);
我收到奇怪的消息,["I"] => float(25861)请帮我获取此字段中的碳数据。
如果我尝试将此浮点数转换为时间戳,我01/01/1970不会收到10/20/1970
我收到的其他日期 ["J"] => float(43195.4092014)
Excel 中的日期与其他软件/编程语言中的日期不同。
Excel 从 1900-01-01 开始计数,不像 UNIX 从 1970-01-01 开始计数。
返回的数字是从 1900-01-01 开始的天数的浮点值,浮点数的分数是一天中的时间。  
例如25861.5,1970-10-20 12:00(“Ymd hi”)。  
要转换为 UNIX,您应该采用返回值 - 25569(Excel 中的 1970-01-01)并乘以 86400(一天以秒为单位)。
请参阅此处:https : //3v4l.org/AudMn
在 Excel 中,如果您将 25861 和 25569 格式化为日期:

你得到的另一个浮点数 43195.4092013889
echo date("Y-m-d h:i", (43195.4092013889-25569)*86400); //2018-04-05 11:49 (mind the timezones)