Here you can find the source of isDateBefore(String date1, String date2)
public static boolean isDateBefore(String date1, String date2)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.util.Date; public class Main { public static boolean isDateBefore(String date1, String date2) { try {/*from w w w. ja v a2 s .c o m*/ DateFormat df = DateFormat.getDateTimeInstance(); return df.parse(date1).before(df.parse(date2)); } catch (ParseException e) { return false; } } public static boolean isDateBefore(String date2) { if (date2 == null) { return false; } try { Date date1 = new Date(); DateFormat df = DateFormat.getDateTimeInstance(); return date1.before(df.parse(date2)); } catch (ParseException e) { return false; } } }