I have a database field where date is stored as DD/MM/YYYY format. Now what I want to do is to see if today date = stored date - 1. Basically if today is the day before the end date. Based on that I will do some action...
example of format:
10/02/2012
There is formatting issue here because am using this:
Date todayDate;
And the stored date is VARCHAR2 in DB. Am assuming I would have to convert the retrieved date to Date regular format, or something like that. Help would be appreciated.
Update:
currentEndDate = rset.getString("ENDDATE");
endDate = (Date)formatter.parse(currentEndDate);
/*Check if end date = today date - 1*/
Calendar cal = Calendar.getInstance();
//set to end date
cal.setTime(endDate);
//end date - 1
cal.add(Calendar.DATE, -1);
Date today;
Now this is what I have..I am trying here to get the end date -1 so I did that using add() function. Now How can I check if end-date - 1 == today date or not? because when I tried :
if(today.equals(cal.add(Calendar.date, -1)))
it said void return from the add function. Thanks,