Bug 54149

Summary: cell.getDateCellValue()
Product: POI Reporter: Jared <spyguy>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Jared 2012-11-15 17:55:52 UTC
If you use the cell.getDateCellValue() function to extract a date from an Excel spreadsheet the month value is -1.  In other words January = 0 .... December = 11.  All the other parts of the dates covert fine only the month is incorrect.  If in an Excel cell there is a date March 15, 2012 08:32:27 and I call cell.getDateCellValue().toString I will get a string March 15, 2012 08:32:27.  However, in the code java.util.Date dateObj = cell.getCellDateValue();  dateObj.getMonth(); the getMonth() will return a 2 for March.
Comment 1 Nick Burch 2012-11-16 00:20:48 UTC
java.util.Calendar and friends follow the C convention, and use 0 based months

See the http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Calendar.html javadocs for details