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