Here you can find the source of compare(Date start, String end)
public static Boolean compare(Date start, String end)
//package com.java2s; //License from project: Apache License import java.util.Date; import java.text.SimpleDateFormat; public class Main { public static final String dtLong = "yyyyMMddHHmmss"; public static Boolean compare(Date start, String end) { SimpleDateFormat format = new SimpleDateFormat(dtLong); String s1 = format.format(start); String s2 = end;//from w w w . j a v a 2 s.c o m java.util.Calendar c1 = java.util.Calendar.getInstance(); java.util.Calendar c2 = java.util.Calendar.getInstance(); try { c1.setTime(format.parse(s1)); c2.setTime(format.parse(s2)); } catch (java.text.ParseException e) { } int result = c1.compareTo(c2); if (result <= 0) { return false; } else { return true; } } }