How to set a date to select a date?

I use DatePickerDialog.OnDateSetListenerthat works great.

I want to add a date within 120 days to the date picker.

I mean that if I add 120 days, the date and month will be automatically changed. How to do it?

+5
source share
2 answers

Something like this should do the trick:

Calendar cal = Calendar.getInstance();
cal.set(datepick.getYear(), datepick.getMonth() + 1, datepick.getDayOfMonth());
cal.add(Calendar.DATE, 120);
datepick.updateDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) - 1, cal.get(Calendar.DATE));
+11
source

, 120 (. , ) , , , . , , . , +120 .

0

All Articles