title: Android DatePickerDialog Api 23 (Android 6)
body: <p>I am triggering a DatePickerDialog, It's working and showing fine till api 22 (Android 5.1), I am setting mix and max dates on it (min = current date, max = 1 month starting from current date), but It's just showing current date in Api 23, I attached code and images.</p>
  
  <pre><code>///////////////////////////////datepickerdialog///////////////////////////////
  public static class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener{
  
      @Override
      public Dialog onCreateDialog(Bundle savedInstanceState){
          final Calendar calendar = Calendar.getInstance();
          int year = calendar.get(Calendar.YEAR);
          int month = calendar.get(Calendar.MONTH);
          int day = calendar.get(Calendar.DAY_OF_MONTH);
  
          /*
              Create a DatePickerDialog using Theme.
  
                  DatePickerDialog(Context context, int theme, DatePickerDialog.OnDateSetListener listener,
                      int year, int monthOfYear, int dayOfMonth)
           */
  
          // DatePickerDialog THEME_DEVICE_DEFAULT_LIGHT
          DatePickerDialog dpd = new DatePickerDialog(getActivity(),this,year,month,day);
  
          if (Build.VERSION.SDK_INT &lt; 22){
  
              dpd.getDatePicker().setCalendarViewShown(true);
              dpd.getDatePicker().setSpinnersShown(false);
              dpd.getDatePicker().getCalendarView().setShowWeekNumber(false);
  
          }
  
          calendar.setTimeInMillis(calendar.getTimeInMillis());
          long mindate = calendar.getTime().getTime();
          calendar.add(Calendar.MONTH, 1);
          long maxdate = calendar.getTime().getTime();
  
          dpd.getDatePicker().setMinDate(mindate);
          dpd.getDatePicker().setMaxDate(maxdate);
  
          dpd.getDatePicker().setMinDate(mindate);
  
          if(Build.VERSION.SDK_INT &lt; 23){
  
              dpd.setTitle("");
  
          }
  
          // Return the DatePickerDialog
          return  dpd;
      }
  
      @SuppressLint("SimpleDateFormat")
      public void onDateSet(DatePicker view, int year, int month, int day){
          // Do something with the chosen date
  
          month++;
  
          evento_fecha = year+"-"+month+"-"+day;          
  
  
          month--;
  
          datetime.set(Calendar.YEAR, year);
          datetime.set(Calendar.MONTH, month);
          datetime.set(Calendar.DAY_OF_MONTH, day);
  
          SimpleDateFormat mSDF = new SimpleDateFormat("dd/MM/yyyy");
          fecha = mSDF.format(datetime.getTime());
  
          //fecha_seleccionada.setText(dia+"/"+mes+"/"+year);
          fecha_seleccionada.setText(fecha);
  
      }
  } 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ciGIL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ciGIL.jpg" alt="Android 5.1"></a></p>
  
  <p><a href="https://i.stack.imgur.com/mDfll.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mDfll.jpg" alt="Android 6"></a></p>
  
  <p>ANSWER 1: Results<a href="https://i.stack.imgur.com/uzLoE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uzLoE.png" alt="ANSWER 1: Results"></a></p>