Here you can find the source of isDate(String strDate, SimpleDateFormat sdf)
public static boolean isDate(String strDate, SimpleDateFormat sdf)
//package com.java2s; /*//from w w w. j ava 2 s. c o m * JLib - Publicitas Java library v1.2.0. * * Copyright (c) 2005, 2006, 2007, 2008, 2009 Publicitas SA. * Licensed under LGPL (LGPL-LICENSE.txt) license. */ import java.text.SimpleDateFormat; public class Main { public static boolean isDate(String strDate, SimpleDateFormat sdf) { boolean isDate = false; try { sdf.parse(strDate); isDate = true; } catch (Exception ex) { isDate = false; //_logger.error("Util.java - Not able to convert strToDate - The given date format is incorrect", ex); } return isDate; } }