Here you can find the source of isDate(final String dateString)
public static boolean isDate(final String dateString)
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static boolean isDate(final String dateString) { // return parseDate(dateString) != null; DateFormat formatter;/* w w w .j av a 2 s. c om*/ try { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); formatter.parse(dateString); return true; } catch (final ParseException d) { try { formatter = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSSZ"); formatter.parse(dateString); return true; } catch (final ParseException e) { try { formatter = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS"); formatter.parse(dateString); return true; } catch (final ParseException f) { try { formatter = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss"); formatter.parse(dateString); return true; } catch (final ParseException g) { try { formatter = new SimpleDateFormat("yyyy-MM-dd"); formatter.parse(dateString); return true; } catch (final ParseException h) { try { formatter = new SimpleDateFormat( "dd.MM.yyyy kk:mm"); formatter.parse(dateString); return true; } catch (final ParseException i) { return false; } } } } } } } }