https://issues.apache.org/bugzilla/show_bug.cgi?id=53474
Yegor Kozlov <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #2 from Yegor Kozlov <[email protected]> --- POI issue tracker is not a place to ask usage questions, please ask on the @poi-user mailing list. The answer depends on how you store date values in Excel: as date or as string. If the value is stored as a date then use cell.getDateCellValue() to get value of cell as a java.util.Date. In this case there is nothing to validate. If the vaue is string then it is up to you how to check: you can fetch the string value and check it against a regex or write a validator yourself. the code might look as follows: switch(cell.getCellType()){ case Cell.CELL_TYPE_NUMERIC: date = cell.getDateCellValue(); break; case Cell.CELL_TYPE_STRING: String sval = cell.getStringCellValue(); if(sval.matches("\\d\\d/\\d\\d/\\d\\d\\d\\d")){ // dd/mm/yyyy // parse as a date } } note that internally Excel stores dates as numbers, that is why the first case is Cell.CELL_TYPE_NUMERIC' Yegor -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
