Here you can find the source of isBeforeDate(String sCompareDate)
public static boolean isBeforeDate(String sCompareDate)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static boolean isBeforeDate(String sCompareDate) { SimpleDateFormat clsFormat = new SimpleDateFormat("yyyy-MM-dd"); try {/*from w ww .ja v a 2 s .c o m*/ Date compareDate = clsFormat.parse(sCompareDate); // Date compareDate = clsFormat.parse("2006-02-11"); Date currentDate = clsFormat.parse(clsFormat.format(new Date())); // Date currentDate =clsFormat.parse("2006-02-06"); if (currentDate.before(compareDate)) { return true; } } catch (ParseException e) { e.printStackTrace(); } return false; } }