다음 날짜를 확인할 다른 방법을 알고 있지만 이전에 사용했을 때 확인 시간을 무시할 가능성이 있는지 알고 싶습니다.이전 날짜를 사용하여 날짜를 확인하는 동안 시간을 무시하는 방법
다음 코드를이
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
try {
if (fired == true) {
return;
} else {
// first time fired
fired = true;
}
String date = checkDigit(monthOfYear + 1) + "/"
+ checkDigit(dayOfMonth) + "/" + year;
strDate = date;
SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
Date d=df.parse(strDate);
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 1);
if(d.before(cal.getTime()))
{
etDOB.setText(strDate);
}
else
{
Toast.makeText(context, "Enter Valid Date Of Birth", Toast.LENGTH_SHORT).show();
etDOB.setText(" ");
}
} catch (ParseException e) {
e.printStackTrace();
}
}
d.before(cal.getTime()) checking date but if the selected Date is next Date than it also checking time
예 : 선택된 날짜 값은 feb 24 2013
너무 D가 동일한
cal.getTime() also contains feb 24 2013
하지만 제 날짜 시간 00:00:00 GMT+5:30
을 갖는 초 시간이 포함되어있다 1:00:00 GMT+5:30
이로 인해 조건이 실패하게됩니다. 그래서 내 질문은 어떻게 시간을 확인하기 전에 무시할 것입니다. 달력 개체를 createing 동안
간단하고 작업 완료 :) – Bruce