Comapring two Calender Objects for same Date object

hi,

I am having problem with Comparing two Calender Objects which is having same Date value but time stamp is not same.when i printed as Calender.getTime()->i found them as.

Cal1-->Wed Feb 28 20:26:29 IST 2007

Cal2>Wed Feb 28 00:00:00 IST 2007

Now the method:

While(Cal1.getTime().compareTo(Cal2.getTime()) ==0 ) is Evaluating false.

i dont want to be concerned with time stamp.i want condition to be true.

Please help me .thx in advance.

Cheers

Akash

[522 byte] By [Akash5495a] at [2007-11-26 17:48:15]
# 1
compare the calendars date, month and year separately ..Cal1.get(Calendar.YEAR) == Cal2.get(Calendar.YEAR) && ........
saracgia at 2007-7-9 5:00:35 > top of Java-index,Java Essentials,New To Java...
# 2
if((Cal1.get(Calendar.YEAR) == Cal2.get(Calendar.YEAR)) &&(Cal1.get(Calendar.MONTH) == Cal2.get(Calendar.MONTH)) &&(Cal1.get(Calendar.DATE) == Cal2.get(Calendar.DATE)) )~TimToo Slow!!
SomeoneElsea at 2007-7-9 5:00:35 > top of Java-index,Java Essentials,New To Java...
# 3
SomeoneElse... ... yes its slow. Is there any alternative?
saracgia at 2007-7-9 5:00:35 > top of Java-index,Java Essentials,New To Java...
# 4

My comment was directed at the fact that you gave the same answer I did, only faster. There is no other way I am aware of that will be any quicker. Of course, that is looking at a small piece of code out of context, so there may well be a better way.

~Tim

Message was edited by:

SomeoneElse

SomeoneElsea at 2007-7-9 5:00:35 > top of Java-index,Java Essentials,New To Java...
# 5
its working .thx a lot for your help.
Akash5495a at 2007-7-9 5:00:35 > top of Java-index,Java Essentials,New To Java...