Recent development of the project, encounter user upload excel file and import the data into the system demand, while some excel in the cell is the date format, this article describes how to read data from excel in date format.

Can first determine the type of cell, there are stored character strings date, some of (the cell number by parsing) stored by date, as follows:

   Cell cell = row.getCell(8);
     Date date = null;
    if (cell.getCellType() == CellType.STRING){
            //按字符串转换日期
      }
    else if (cell.getCellType() == CellType.NUMERIC) {
                date  = cell.getDateCellValue();
         }

Guess you like

Origin www.cnblogs.com/super-hu/p/12092977.html