I know there are quite a lot of question for this but none of the solutions are working for me, so this question. I want to restrict user to select date before today, but am
Get System Time and subtract 1 second from It
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
dialog = new DatePickerDialog(act, listener, year, month, day);
dialog.getDatePicker().setMinDate(System.currentTimeMillis() -1000);
return dialog;
}