Here you can find the source of isValidDate(String dt)
public static boolean isValidDate(String dt)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static boolean isValidDate(String dt) { //__Prepare result Boolean result = true;//from w w w.j a v a 2 s .c om String dateformat = "yyyyMMdd"; try { SimpleDateFormat sdf = new SimpleDateFormat(dateformat); sdf.setLenient(false); sdf.parse(dt); } catch (ParseException e) { result = false; } catch (IllegalArgumentException e) { result = false; } return result; } }