Reading date as string from excel using apache poi
I am trying to use the apache poi library to read excel. I want to convert a date field to a String value. So I used the following code:
if(cell.getCellType()==Cell.CELL_TYPE_NUMERIC){
if(DateUtil.isCellDateFormatted(cell)){
DataFormatter df = new DataFormatter();
FormulaEvaluator fe = Workbook.getCreationHelper().createFormulaEvaluator();
String str= formatter.formatCellValue(cell, fe);
return str;
}
}
I am getting Dates in a weird form which is <3/12 / [] 15>. The value of the cell id is 3/12/2015. Can anyone guide me on this.
+3
source to share