Closed Greathfs closed 7 years ago
@Greathfs This is the same behavior as the stock DatePickerDialog
that Android provides. Months are index-based, that is, the months in the year are 0 (January) through 11 (December).
I'm aware that this is not exactly intuitive, but I wanted to emulate the stock behavior. If you want the months to start with 1 for January, just add 1 to the month.
Thanks for your answer.I tried it just now,and it worked.Thanks again.
public void onDateSet(AppCompatDatePicker view, int year, int month, int day) { // Do something with the date chosen by the user Toast.makeText(getContext(), "year="+year+"month="+month+"day="+day, Toast.LENGTH_SHORT).show(); }
The month is not corrent.For example,the current month is12,it will show 11.