Bug 54149 - cell.getDateCellValue()
Summary: cell.getDateCellValue()
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2012-11-15 17:55 UTC by Jared
Modified: 2012-11-16 00:20 UTC (History)
0 users


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