Here you can find the source of compareDate(String startdate, String enddate)
public static boolean compareDate(String startdate, String enddate)
//package com.java2s; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String DEF_DATE_FORMAT = "yyyy-MM-dd"; public static boolean compareDate(String startdate, String enddate) { SimpleDateFormat formatter = new SimpleDateFormat(DEF_DATE_FORMAT); Date sd = formatter.parse(startdate, new ParsePosition(0)); Date ed = formatter.parse(enddate, new ParsePosition(0)); return sd.before(ed); }//w w w . ja v a2s .c o m }