나는 두 개의 날짜가있어서이를 비교하려고합니다. 정확한 날짜인지 기록하기 위해 실제 날짜를 기록했습니다. date compareTo() 메서드는 항상 -1을 반환합니다.
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);
}
은 어떤 이유로 compareTo 메소드는 항상 반환 -1이 날짜
하지 날짜 인수 이전 인 경우에도 마찬가지입니다.
항목 : http://stackoverflow.com/questions/1439779/how-to-compare-two- 날짜 - 시간 - 부분 - – Vlad