Bug 58460 - Cell.getDateCellValue() does not document special case when cell value is between 0 and 1
Summary: Cell.getDateCellValue() does not document special case when cell value is bet...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 3.11-FINAL
Hardware: All All
: P2 trivial (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-26 13:31 UTC by Vedant Lath
Modified: 2015-09-26 13:33 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.