posted 23 years ago
Hey Madhuri,
It might not be the most efficient way, but the way you could make sure it works would be to write a little code like this after you parsed your date Strings:
int daysGoneBy = 0;
Calendar calToday = Calendar.getInstance();
calToday.set(2001,07,14);
Calendar calAMonthAgo = Calendar.getInstance();
calAMonthAgo.set(2001,06,12);
while (calToday.after(calAMonthAgo)) {
daysGoneBy++;
calAMonthAgo.add(Calendar.DATE, 1);
}
System.out.println("There were " + daysGoneBy + " days between now and then.");
Hope it helps,
Larry