private String getFormattedDate(XSSFCell cell) { DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.ROOT); sdf.setTimeZone(LocaleUtil.getUserTimeZone()); return sdf.format(cell.getDateCellValue()); }
DateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy", LocaleUtil.getUserLocale()); sdf.setTimeZone(LocaleUtil.getUserTimeZone()); return sdf.format(getDateCellValue());
private String getFormattedDate(XSSFCell cell) { DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.ROOT); sdf.setTimeZone(LocaleUtil.getUserTimeZone()); return sdf.format(cell.getDateCellValue()); }
if (DateUtil.isCellDateFormatted(cell)) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); value = format.format(cell.getDateCellValue()); } else { value = String.valueOf(cell.getNumericCellValue());
@Override public String getCellValue(int rowNum, int colNum) { XSSFRow row = sheet.getRow(rowNum); XSSFCell cell = row.getCell(colNum, Row.CREATE_NULL_AS_BLANK); switch (cell.getCellType()) { case Cell.CELL_TYPE_BLANK: case Cell.CELL_TYPE_STRING: return cell.getStringCellValue(); case Cell.CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { return LimsUtils.formatDate(cell.getDateCellValue()); } else { return Double.toString(cell.getNumericCellValue()).replaceFirst("\\.0+$", ""); } default: throw new IllegalArgumentException("Unhandled cell type"); } }
DateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy", LocaleUtil.getUserLocale()); sdf.setTimeZone(LocaleUtil.getUserTimeZone()); return sdf.format(getDateCellValue());
/** * Returns a string representation of the cell * <p> * Formula cells return the formula string, rather than the formula result. * Dates are displayed in dd-MMM-yyyy format * Errors are displayed as #ERR<errIdx> * </p> */ public String toString() { switch (getCellType()) { case CELL_TYPE_BLANK: return ""; case CELL_TYPE_BOOLEAN: return getBooleanCellValue() ? "TRUE" : "FALSE"; case CELL_TYPE_ERROR: return ErrorEval.getText(getErrorCellValue()); case CELL_TYPE_FORMULA: return getCellFormula(); case CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(this)) { DateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy"); return sdf.format(getDateCellValue()); } return getNumericCellValue() + ""; case CELL_TYPE_STRING: return getRichStringCellValue().toString(); default: return "Unknown Cell Type: " + getCellType(); } }
case Cell.CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { value = cell.getDateCellValue(); } else { value = cell.getNumericCellValue();