Im trying to get the Day / Month / Year from my datepicker. I have the problem that the Month en the day never is correct. I give you the code below. The month is correct but it fails when the month is december. The day is never correct.
public class myOnDateChangedListener implements OnDateChangedListener {
public void onDateChanged(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
if (view.getId() == R.id.datePicker1) {
startDay = view.getDayOfMonth();
if(view.getMonth() == 11){
startMonth = 12;
}else{
startMonth = (view.getMonth() + 1);
}
startYear = view.getYear();
}
if (view.getId() == R.id.datePicker2) {
endDay = view.getDayOfMonth();
if(view.getMonth() == 11){
endMonth = 12;
}else{
endMonth = (view.getMonth() + 1);
}
endYear = view.getYear();
}
}
}