import java.text.DateFormat;
public class Main {
public static boolean isValidDateStr(String date) throws Exception {
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
df.setLenient(false);
df.parse(date);
return true;
}
public static void main(String[] args) throws Exception{
System.out.println(isValidDateStr("1900-13-12"));
}
}
|