Here you can find the source of isDate(String str)
public static boolean isDate(String str)
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static String DATE_FORMAT_A = "MMddyyyy"; public static boolean isDate(String str) { boolean isDate = false; if (str == null) return isDate; str = str.replaceAll("[/-]", ""); DateFormat df = new SimpleDateFormat(DATE_FORMAT_A); try {//w w w. j a v a 2 s . c o m df.parse(str); isDate = true; } catch (ParseException ex) { } return isDate; } }