Here you can find the source of isDate(String strDate, String pattern)
public static final boolean isDate(String strDate, String pattern)
//package com.java2s; //License from project: Apache License import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final boolean isDate(String strDate, String pattern) { SimpleDateFormat formatter = new SimpleDateFormat(pattern); formatter.setLenient(false);/*from ww w . ja va2s . co m*/ ParsePosition pos = new ParsePosition(0); try { Date d = formatter.parse(strDate, pos); return true; } catch (Exception e) { return false; } } }