Problem with comparing dates.
1 posts in topic
Flat View  Flat View

Posted By:   Mariola_Gburzynski
Posted On:   Thursday, October 11, 2001 08:59 AM

I need to compare the Calendar objects: after, before and equal

disregarding the hours and seconds. That is, if month, day and year are

equal than the result is true.

Are the any methods/classes that would do that?


Re: Problem with comparing dates.

Posted By:   Ivo_Limmen  
Posted On:   Thursday, October 11, 2001 10:31 AM

The Date object contains all of these methods. You you get a Date object from a Calendar object by calling: getTime().

Calendar date1 = ...
Calendar date2 = ...

if(date1.getTime().equals(date2.getTime())) {
System.out.println("Dates are equal...");
} else {
system.out.println("Dates are not equal...");
About | Sitemap | Contact