Here you can find the source of checkDate(String begingDate, String endDate)
public static boolean checkDate(String begingDate, String endDate)
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static boolean checkDate(String begingDate, String endDate) { boolean boo = true; Date begin = null;// www.ja va 2 s . c om Date end = null; DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); if (null == begingDate || "".equals(begingDate)) { boo = false; return boo; } if (null == endDate || "".equals(endDate)) { boo = false; return boo; } try { begin = df.parse(begingDate); end = df.parse(endDate); } catch (ParseException e) { e.printStackTrace(); } if (begin.compareTo(end) >= 0) { boo = false; } return boo; } public static String parse(Date d) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); String dateStr = sdf.format(d); return dateStr; } }