Here you can find the source of isValidDateInternal(String date, String dateFormat)
private static boolean isValidDateInternal(String date, String dateFormat)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { private static boolean isValidDateInternal(String date, String dateFormat) { try {//from www .ja va 2 s.c om DateFormat df = new SimpleDateFormat(dateFormat); df.setLenient(false); df.parse(date); return true; } catch (ParseException e) { return false; } } }