SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy", LocaleUtil.getUserLocale()); sdf.setTimeZone(LocaleUtil.getUserTimeZone()); return sdf.format(getDateCellValue());
protected Object getDateValue(HSSFCell cell) { // Simplification and the use of Chinese date format return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cell .getDateCellValue()); }
HSSFCell cell = (HSSFCell) cellIter.next(); SimpleDateFormat DtFormat = new SimpleDateFormat("dd.MM.YY"); Date date=cell.getDateCellValue(); System.out.println(DtFormat.format(date).toString());
private String getDateFromColumn(HSSFRow row, int i) { try { return new SimpleDateFormat("dd-MM-yy").format(row.getCell((short) i).getDateCellValue()); } catch (Exception e) { return row.getCell((short) i).getStringCellValue(); } }
HSSFCell cell = poiFilaActual.getCell(intColActual); if (cell != null) { if (HSSFCell.CELL_TYPE_STRING == cell.getCellType()) { return cell.getRichStringCellValue().toString(); } else if (HSSFCell.CELL_TYPE_BOOLEAN == cell.getCellType()) { return new String( (cell.getBooleanCellValue() == true ? "true" : "false") ); } else if (HSSFCell.CELL_TYPE_BLANK == cell.getCellType()) { return ""; } else if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType()) { if(HSSFDateUtil.isCellDateFormatted(cell)){ return ( new SimpleDateFormat("dd/MM/yyyy").format(cell.getDateCellValue()) ); }else{ return new BigDecimal(cell.getNumericCellValue()).toString(); } } }
private static String getCellvalue(HSSFRow poiRow, int intColActual) { if (poiFilaActual != null && poiRowActual.getLastCellNum() >= (short) intColActual) { HSSFCell cell = poiRowActual.getCell(intColActual); if (cell != null) { if (HSSFCell.CELL_TYPE_STRING == cell.getCellType()) { return cell.getRichStringCellValue().toString(); } else if (HSSFCell.CELL_TYPE_BOOLEAN == cell.getCellType()) { return new String( (cell.getBooleanCellValue() == true ? "true" : "false") ); } else if (HSSFCell.CELL_TYPE_BLANK == cell.getCellType()) { return ""; } else if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType()) { if(HSSFDateUtil.isCellDateFormatted(cell)){ return ( new SimpleDateFormat("dd/MM/yyyy").format(cell.getDateCellValue()) ); }else{ return new BigDecimal(cell.getNumericCellValue()).toString(); } } } } return null; }
log.debug("using numeric"); if (Date.class.isAssignableFrom(destClazz)) { return cell.getDateCellValue();
return sdf.format(getDateCellValue());
return sdf.format(getDateCellValue());
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy", LocaleUtil.getUserLocale()); sdf.setTimeZone(LocaleUtil.getUserTimeZone()); return sdf.format(getDateCellValue());