I saw this question when stack overflowed in several places, but these answers do not work for me, so here I am :).
I need to set the minimum date of the date selection dynamically to the current date. My minimum API is 12.
I tried this:
Calendar minCalendar = Calendar.getInstance(); minCalendar.set(Calendar.MILLISECOND, minCalendar.MILLISECOND - 1000); DatePicker endDatePicker = (DatePicker) findViewById(R.id.datePicker2); endDatePicker.setMinDate(minCalendar.getTimeInMillis());
I do not get any errors, only the date of selection is not set to date. It is set for October 1964 ....
Please help me...
edited
I also tried this, but the same effect:
endDatePicker.setMinDate(System.currentTimeMillis() - 1000);
source share