public static boolean isDateTime(String dateVal) {
if (dateVal != null) {
if (dateVal.length() != "yyyy-MM-dd HH:mm:ss".length()) {
return false;
}
}
Date exitDate = null;
if(dateVal != null){
try {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
exitDate = df.parse(dateVal);
} catch (ParseException e) {
return false;
}
}
String strDate = null;
if(exitDate != null) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
strDate = df.format(exitDate);
}
return dateVal.equals(strDate);
}
if (dateVal != null) {
if (dateVal.length() != "yyyy-MM-dd HH:mm:ss".length()) {
return false;
}
}
Date exitDate = null;
if(dateVal != null){
try {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
exitDate = df.parse(dateVal);
} catch (ParseException e) {
return false;
}
}
String strDate = null;
if(exitDate != null) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
strDate = df.format(exitDate);
}
return dateVal.equals(strDate);
}