I've got two Dates and I want to compare them. I've logged the actual date to make sure its correct and it is.
Date photoDate = new Date(mPhotoObject.calendar.getTimeInMillis());
SimpleDateFormat dateFormat = new SimpleDateFormat("M.d.yy");
Log.v("photo date is", dateFormat.format(photoDate));
Date currentDate = new Date(Calendar.getInstance().getTimeInMillis());
Log.v("current date is", dateFormat.format(currentDate));
Log.v("date comparison", photoDate.compareTo(currentDate)+"");
if(photoDate.compareTo(currentDate)<0) {
view.showFooButton(false);
} else {
view.showFooButton(true);
}
For some reason the compareTo method is always returning -1 even if this date is not before the Date argument.