Here you can find the source of isDate(String strDate, String pattern)
public static boolean isDate(String strDate, String pattern)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static boolean isDate(String strDate, String pattern) { try {// ww w . j a v a2 s.c o m parse(strDate, pattern); return true; } catch (ParseException pe) { return false; } } public static Date parse(String strDate, String pattern) throws ParseException { try { return getFormatter(pattern).parse(strDate); } catch (ParseException pe) { throw new ParseException("Method parse in Class DateUtil err: parse strDate fail.", pe.getErrorOffset()); } } private static SimpleDateFormat getFormatter(String parttern) { return new SimpleDateFormat(parttern); } }