I am comparing two same date and output that I am getting is -1. As far as I know it should be 0 for same date.
The image from the debug mode is attached here. How could this issue will be solved?
I am comparing two same date and output that I am getting is -1. As far as I know it should be 0 for same date.
The image from the debug mode is attached here. How could this issue will be solved?
You can use this post to compare two date without time like this.
if (removeTime(questionDate).equals(removeTime(today))
...
public Date removeTime(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
}