Here you can find the source of compareDate(String s, String e)
public static boolean compareDate(String s, String e)
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public class Main { private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static boolean compareDate(String s, String e) { if (fomatDate(s) == null || fomatDate(e) == null) { return false; }//from www .j a v a 2s.c o m return fomatDate(s).getTime() >= fomatDate(e).getTime(); } public static Date fomatDate(String date) { DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); try { return fmt.parse(date); } catch (ParseException e) { e.printStackTrace(); return null; } } public static String getTime() { return sdfTime.format(new Date()); } }