Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static boolean isPastDate(String year, String month, String day) { try { GregorianCalendar cal = new GregorianCalendar(); cal.setLenient(false); SimpleDateFormat fmDate = new SimpleDateFormat("yyyyMMdd"); String today = fmDate.format(cal.getTime()); cal.clear(); cal.set(Integer.parseInt(year), Integer.parseInt(month) - 1, Integer.parseInt(day)); String inputday = fmDate.format(cal.getTime()); if (inputday.compareTo(today) < 0) { return true; } else { return false; } } catch (IllegalArgumentException e) { return false; } } }