Re: Comparing dates in java
if somebody still want this. you could use this
Date modDate = removeTime(your first date);
Date curDate = removeTime(your 2nd date);
if (modDate.before(curDate)) {
........
}
private Date removeTime(Date pDate){
Calendar cal = Calendar.getInstance();
cal.setTime(pDate);
// Set time fields to zero
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
// Put it back in the Date object
return cal.getTime();
}
Re: Comparing dates in java
Quote:
Originally Posted by
junnydc
if somebody still want this. you could use this
Spoonfeeding is not helping. Besides, that doesn't actually answer the OP's actual question!