Here I present you my JAVA code in Eclipse for some appointments' dates. I am trying to create some appointments with JAVA servlets and mySQL:
Date today = new Date();
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
Date myDate = null;
try {
myDate = sdf1.parse("2017-06-22");
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("My Date is"+myDate);
System.out.println("Today Date is"+today);
if (today.compareTo(myDate)<0)
System.out.println("Today Date is Lesser than my Date");
else if (today.compareTo(myDate)>0)
System.out.println("Today Date is Greater than my date");
else
System.out.println("Both Dates are equal");
}
I am trying to create a delete form in Java of some appointments for some patients. I would like some help on how to compare the "today" date (present date) with another date. And how to check if the appointment that the patient is trying to delete is not in less than 3 days. Any ideas?
Thanks in advance.