springmvc+mybatis 使用 POIFSFileSystem 读取excel中的日期 问题

来源:互联网 发布:green网络加速器下载 编辑:程序博客网 时间:2024/05/17 18:48
public String getCell(HSSFCell cell) {DecimalFormat df = new DecimalFormat("#");if (cell == null)return "";switch (cell.getCellType()) {case HSSFCell.CELL_TYPE_NUMERIC:if(HSSFDateUtil.isCellDateFormatted(cell)){SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");return sdf.format(HSSFDateUtil.getJavaDate(cell.getNumericCellValue())).toString();}return df.format(cell.getNumericCellValue());case HSSFCell.CELL_TYPE_STRING:System.out.println(cell.getStringCellValue());return cell.getStringCellValue();case HSSFCell.CELL_TYPE_FORMULA:return cell.getCellFormula();case HSSFCell.CELL_TYPE_BLANK:return "";case HSSFCell.CELL_TYPE_BOOLEAN:return cell.getBooleanCellValue() + "";case HSSFCell.CELL_TYPE_ERROR:return cell.getErrorCellValue() + "";}return "";

}

HSSFCell cell = row.getCell(2);

0 0
原创粉丝点击