I have a project requirement. There are values in a .txt as -
02/01/2017 00:00:00
Now I need to have some rules to check if this value in the
Try to parse it to date. If it throws ParseException then it is not a date.
ParseException
String dateString = "02/01/2017 00:00:00"; DateFormat df = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss"); Date date; try { date = df.parse(dateString); } catch (ParseException e) { e.printStackTrace(); }