poi excel导入获取日期格式

  1. if (cell.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(cell)){
  2. cell.setCellType(CellType.NUMERIC);
  3. String strDate = "";
  4. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
  5. Date data = DateUtil.getJavaDate(cell.getNumericCellValue());
  6. strDate = format.format(data);
  7. String fieldCode = orderField.get(i).getFieldCode();
  8. String fieldName = orderField.get(i).getFieldName();
  9. ProductInputResult productInputResult = new ProductInputResult(fieldCode, fieldName, strDate);
  10. productInputResultList.add(productInputResult);
  11. }

发表评论

表情:
评论列表 (有 0 条评论,76人围观)

还没有评论,来说两句吧...

相关阅读

    相关 poi批量导入excel

    1.先下载poi依赖的包,复制张贴代码一定没有错误 2.直接上代码,如果导入有错误,可能是别人给你发的excel模版有错误,可以自己创建一个excel测试