I am trying to get a date from an Excel cell using Java Apache POI library.
The field contains a date 30.1.2019 12:00:00 and I've selected d.m.yyyy h:mm
as format string for that cell. When I loop over the Excel sheet with apache POI, it reports the call as of type CellType.NUMERIC
and returns value 43495.5.
I have no idea what to do with that number. It's too small for it to be seconds since UNIX epoch.
Noteworthy: When I open the file in MS Excel and change the cell's format to normal number, I also see 43495.5 directly in Excel. So the value probably has meaning, I just don't know how to parse it.
Maybe I'm just doing it wrong. How to get the date from Excel via Apache POI, ideally as java.util.Date
?
DataFormatter
as shown in Getting the cell contents to avoid such problems. Else you needs switching byCellType
as also shown in linked users guide. Btw.: Yes the number has meaning. It is 43495.5 days after 01/01/1900. – Axel Richter