Java tutorial
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static void main(String[] args) throws ParseException { SimpleDateFormat dateFormat = new SimpleDateFormat("ddMMyyyy"); Calendar cal = Calendar.getInstance(); String today = dateFormat.format(cal.getTime()); System.out.println(today); SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyy"); Date actualdate = sdf.parse(today); Date date1 = sdf.parse("20042014"); Date date2 = sdf.parse("23042015"); Calendar actual = Calendar.getInstance(); Calendar cal1 = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance(); actual.setTime(actualdate); cal1.setTime(date1); cal2.setTime(date2); System.out.println(actual); System.out.println(cal1); System.out.println(cal2); if (actualdate.after(date1) && actualdate.before(date2)) { System.out.println("Yes"); } else { System.out.println("No"); } if (actual.after(cal1) && actual.before(cal2)) { System.out.println("Yes"); } else { System.out.println("No"); } } }