compare to Dates only
Posted on 2004-04-08
I have 2 java.util.Date objects
I want to compare those 2 dates
I am using the following statement
int result = stDt.compareTo(endDt);
i am wondering sometimes even though both the dates are same, it's returning -1
I don't understanding why it's returning zero sometimes and -1 sometimes
even though both the dates are same.
Basically i need a function which should comapare 2 dates. it should give me true if both the dates have same yyyy-MM-dd, even though they have different HH:mm:ss.
It should compare only date part, not time part.
i guess you got my requirement.
Is there any such method in Java?
I appreciate your help!