2009-03-23 3 views
0

나는 기본적으로 날짜가 변경되지 않고 실행이누구든지 날짜 속성에 관한 자바 문제를 도울 수 있습니까?

내 날짜 필드이

   StartDate = new DateField("Start Date ", DateField.DATE); 
       cal1 = Calendar.getInstance(); 
       cal1.set(Calendar.YEAR, 2009); 
       cal1.set(Calendar.MONTH, 3); 
       cal1.set(Calendar.DAY_OF_MONTH, 1); 
       StartDate.setDate(cal1.getTime()); 

같은 설정이 경고 인 경우

을하고 싶은 말과 내가 이것을 가지고하지만 난 시작할 경우 확실하지 않다 그것을 옳게 만드십시오. 그것은 나에게 보인다

 if(StartDate.equals(Calendar.DAY_OF_MONTH, 1)) 
     { 

     AlertNameNotEntered.setString("Please select a Start Date"); 
     mDisplay.setCurrent(AlertNameNotEntered); 
     } 

감사

+0

? 유망 날짜가 월 첫날과 같은지 비교하고 싶습니까? – OscarRyz

답변

1

난 당신이 뭔가를 원하는 가정 정확히 당신이 원하는 것을 무엇

if(StartDate.getDate().getTime() == cal1.getTime()) // Date is unchanged 
    { 
    AlertNameNotEntered.setString("Please select a Start Date"); 
    mDisplay.setCurrent(AlertNameNotEntered); 
    } 
1

당신은 기본적인 자바에 대한 지식에 꽤 많은 차이가있다. 언어와 표준 라이브러리를 알기위한 지름길은 없습니다. javadocs에 Calendar, DateDateField 클래스를 문의하십시오.

관련 문제