java jxl读取excel中Date类型

Workbook book = Workbook.getWorkbook(excel);
Sheet sheet = book.getSheet(0);
int clos = sheet.getColumns();//得到所有的列
int rows = sheet.getRows();//得到所有的行
for (int i = 1; i < rows; i++) {
    for (int j = 0; j < clos; j++) {
        //sheet.getCell(j, i).getContents();//第一个是列数,第二个是行数
        String columnValue = "";
        if ("DATE".equals(dataTypeMap.get(titles[j]))) {
            DateCell dc = (DateCell) sheet.getCell(j, i);
            Date data = dc.getDate();
            SimpleDateFormat dataFormat = new SimpleDateFormat("yyyy-MM-dd");
            String columnValue = dataFormat.format(data);
        } else {
            columnValue = sheet.getCell(j, i).getContents();
        }
    }
}
原文地址:https://www.cnblogs.com/BobXie85/p/9857377.html