Phpspreadsheet - Time cell retrieved as float

后端 未结 2 461
说谎
说谎 2021-01-21 08:47

I have an excel file which has a time input.

  Mar 01, 2018  | Thursday  | 8:00 AM | 5:00 PM
  Mar 02, 2018  | Friday    | 8:00 AM | 5:00 PM

B

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-21 09:15

    Thankfully I have found the answer just now.

    $in = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($time_in);
    echo gmdate("g:i a", $in);
    

    Hopefully, this could be useful for others.

提交回复
热议问题