Here you can find the source of isValidDate(String date)
public static boolean isValidDate(String date)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public final static String DATE_FORMAT = "yyyy-MM-dd"; public static boolean isValidDate(String date) { return isValidDateInternal(date, DATE_FORMAT); }/*from www. ja v a 2 s . c o m*/ private static boolean isValidDateInternal(String date, String dateFormat) { try { DateFormat df = new SimpleDateFormat(dateFormat); df.setLenient(false); df.parse(date); return true; } catch (ParseException e) { return false; } } }