今天在项目中用到了poi解析Excel 其中有日期格式读取出来之后是时间戳,double
之前的代码:
// 第一行为标题
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
for (Row row : sheet) {
ArrayList<String> list = new ArrayList<String>();
for (Cell cell : row) {
if (cell.getCellType() == cell.CELL_TYPE_NUMERIC&&cell.toString().length()>7) {
// double value = cell.getNumericCellValue();
// String str = df.format(value).toString();
list.add(value2);
} else {
// 根据不同类型转化成字符串
cell.setCellType(Cell.CELL_TYPE_STRING);
list.add(cell.getStringCell