Excel单元格中的数据是日期格式:比如:1991-09-9 ,可是cell.getNumericCellValue()取值后结果为 28011.0,如何才能得到正确的结果,向大吓求救!

解决方案 »

  1.   

    看poi的例子org.apache.poi.hssf.usermodel.examples的CreateDateCells.java        cell.setCellValue(new Date());
            HSSFCellStyle cellStyle = wb.createCellStyle();
            cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm"));
            cell = row.createCell((short)1);
            cell.setCellValue(new Date());
            cell.setCellStyle(cellStyle);