Here you can find the source of checkDateValidity(String str, String formatString)
public static boolean checkDateValidity(String str, String formatString)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static boolean checkDateValidity(String str, String formatString) { SimpleDateFormat sdf = new SimpleDateFormat(formatString); sdf.setLenient(false);//from ww w . j av a 2 s . c o m try { sdf.parse(str); return true; } catch (ParseException e) { return false; } } }