Here you can find the source of isDateFormat(String timeString)
public static boolean isDateFormat(String timeString)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; public class Main { public static boolean isDateFormat(String timeString) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); format.setLenient(false);/*w ww.j a v a 2s. c om*/ try { format.parse(timeString); } catch (Exception e) { return false; } return true; } }