안드로이드 개발 질문/답변
(글 수 45,052)
GregorianCalendar cal =new GregorianCalendar();
cal.set( 2012, 2 -1, 13 + 3000); // 2020 년 5월 00 일이 입니다.
정상적인 일수는 4월 30, 일이 3000 일 되는 날입니다.
그래서 5 (달 month) 에서 -1 해주고 임의적으로 아래와 같이 했습니다.
cal.set(2012, 4, 1);
int last_Day = getActualMaximum(Calendar.DAY_OF_MONTH);
그리고 4월달에 마지막막 날짜를 구하기 위해 위와 같은 코드를 입력했는데..
31이란 숫자가 나옵니다. .. 2020년 4월 달은 30일밖에 없는데도.. 저렇게 나오더군요.
머때문일 까요..
2012.04.18 18:32:10
추가 합니다.
Calendar 클래스에 아래와 같은 월표시 예약어가 있으니 사용하시는게 덜 헷갈리시지 않을까 합니다.
(*4월 => 3이네요..)
public static final int APRIL
Since: API Level 1
Value of the MONTH field indicating the fourth month of the year.
Constant Value: 3 (0x00000003)
public static final int AUGUST
Since: API Level 1
Value of the MONTH field indicating the eighth month of the year.
Constant Value: 7 (0x00000007)




Calendar.DATE 한번 해보세요(X)
=> 수정 합니다. month 의 경우 0월 부터였던듯 합니다. 4이면 5월인걸로 알고 있습니다.