Bug 58460

Summary: Cell.getDateCellValue() does not document special case when cell value is between 0 and 1
Product: POI Reporter: Vedant Lath <vedant>
Component: SS CommonAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: trivial CC: vedant
Priority: P2    
Version: 3.11-FINAL   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Vedant Lath 2015-09-26 13:31:08 UTC
When a cell value is in the interval [0, 1), org.apache.poi.ss.usermodel.Cell.getDateCellValue() returns a Date with the date 1899-12-31. This cannot be converted back to an Excel Date as the year is now less than 1900.

In such a case, the comparison excelDate == DateUtil.getExcelDate(DateUtil.getJavaDate(excelDate,false)) also fails.

It is not immediately apparent that excel dates in the interval [0, 1) do not have an equivalent Date value in Java. A naive user might expect such a value to be converted to 1900-01-01 xx:xx:xx instead of 1989-12-31 xx:xx:xx.

Please document this behaviour in the getDateCellValue() method and in the DateUtil class.