excelize icon indicating copy to clipboard operation
excelize copied to clipboard

value from datetime format cell is wrong

Open dw130 opened this issue 3 years ago • 5 comments

image image

use GetRows function read value is 44087

golang 16 excelize version: v2.5.0

dw130 avatar Jan 04 '22 07:01 dw130

@xuri

dw130 avatar Jan 04 '22 07:01 dw130

Thanks for your feedback, this issue is similar to #1093, the library support parsing build-in date and time number format under English (United States) currently, and I'll consider implementing number format lexer and parser to support multi-language location and custom number format.

xuri avatar Jan 04 '22 09:01 xuri

In the meantime i think you have to convert the date via excelize.ExcelDateToTime as 44087 is a correct excel date see here.

eqinox76 avatar Jan 04 '22 13:01 eqinox76

@xuri Is there any way to fetch the raw value current now ? I use the GetCellType function, return value is CellTypeUnset CellType If the GetCellType returns right value (CellTypeDate), I can use excelize.ExcelDateToTime function But GetCellType seems not work

dw130 avatar Jan 05 '22 04:01 dw130

Hi @dw130, please specify RawCellValue field as true in the options of the GetCellValue, GetRows or rows/columns iterator, and reference details about the result of GetCellType in this comment of the issue.

xuri avatar Jan 11 '22 16:01 xuri

Hi @dw130, @eqinox76, the excelize library improvements for reading cell value with number format in the recently released version. Please upgrade to the lasted version or use the master branch code. The date time cell result can be read correctly. I closed this issue. If you have any questions, please let me know, and you can reopen this anytime.

xuri avatar Nov 01 '23 11:11 xuri