如何通过Apache POI 3.9从xls / xlsx读取时间格式?

我有一个1:20时间值(1:20:00)的单元格。 我怎样才能读取由Apache poi 3.9 ? 我的代码正在检查两种单元格types,当它读取时间值时,它将转到CELL_TYPE_NUMERIC1:20将为0 。 我怎么能读到正确的1:20 ? 谢谢!

 switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_NUMERIC: cellValue = String.valueOf((int) (cell.getNumericCellValue())); break; case HSSFCell.CELL_TYPE_STRING: cellValue = cell.getStringCellValue(); break; } 

我做的!!

 switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_NUMERIC: if(DateUtil.isCellDateFormatted(cell)) { cellValue = new DataFormatter().formatCellValue(cell); } else { cellValue = String.valueOf((int) (cell.getNumericCellValue())); } break; case HSSFCell.CELL_TYPE_STRING: cellValue = cell.getStringCellValue(); break; }