EDIT: I know this is a common issue, I have read plenty of people reporting the problem, but I have not found a acceptable answer. -- Please help.
O.K. so I have a little class that reads an excel table, and writes the cell values to XML.
The program has always worked great, and even handles the different cell types; boolean, string, formula, numbers.
Problem is dates. Date cells are treated equal to number cells, but I need to distinguish their format type. Right now I read them all as numbers, but I need to change this, because dates occur like 35356(days since jan 01 01).
I tried some basic formating checks;
System.out.println("Date Debug:");
System.out.println(".isValidExcelDate: "+HSSFDateUtil.isValidExcelDate(currentRow.getCell((short) (useColumn)).getNumericCellValue()));
System.out.println(".isCellDateFormatted: " +HSSFDateUtil.isCellDateFormatted(currentRow.getCell((short) (useColumn) )));
System.out.println(".isInternalDateFormat: "+HSSFDateUtil.isInternalDateFormat((int) (currentRow.getCell((short) (useColumn)).getNumericCellValue() )));
//
But they return true false false for any number..riddiculus!
Anyway, as it will work now, I'll just read the columns header for a 'date' in the the title. I am anxiously seeking better ideas, please suggest.
Thanks so much!
Notes:
*before and after are not acceptable, because i will have values above 39000 for numbers and dates as low as 1971.
* some reason i can't just read the value as it is displayed in excel ('2007-08-28') which is what I'd prefer. (If you think i can, please let me know how)
*please ask any questions to clarify my situation to resolve :-)
Message was edited by:
Masterkeedu
Acknowledged commonality