我在的DatePicker
一个问题,Android的,当我使用的getMonth()
方法,那么它会返回一个错误值。
I have a problem in DatePicker
in android when I use getMonth()
method then it will return a wrong value.
例如:
DatePicker datepicker=new DatePicker();
int day=date.getDayOfMonth();
int month=date.getMonth();
int year=date.getYear();
t.setText(""+day+" / "+month+" / "+year);
如果我将选择1987年8月6日,然后将返回1987年6月7日
If I will select aug 06 1987 then it will return 6/7/1987
我认为这是一个错误,如果不告诉我的原因吧。
I think it is an error, if not tell me the reason please.
月被编入索引从0开始,所以八月是8月或索引7,从而给你正确的结果。请参阅Android SDK。
Months are indexed starting at 0, so August is month 8, or index 7, thus giving you the correct result. See Android SDK.
下一篇:Web服务会话管理Web