Here you can find the source of compareDate(String date)
public static boolean compareDate(String date)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static boolean compareDate(String date) { Date d = new Date(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); String dateNowStr = df.format(d); try {//from ww w.ja va 2 s. c o m Date dt1 = df.parse(date); Date dt2 = df.parse(dateNowStr); if (dt1.getTime() > dt2.getTime()) { return true; } else { return false; } } catch (Exception exception) { exception.printStackTrace(); return false; } } }