title: How to set Date in DD-MMM-YYYY format in android
body: <p>Edittext CheckIndate When i Select checkindate date will be append in  2016-08-08
  But i wanted into this format like 08-Aug-2016
  How can i implement this please help me.</p>
  
  <pre><code>CheckInDate.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick (View v){
      if (v == CheckInDate) {
          final Calendar c = Calendar.getInstance();
          int mYear = c.get(Calendar.YEAR);
          int mMonth = c.get(Calendar.MONTH);
          int mDay = c.get(Calendar.DAY_OF_MONTH);
          c.set(Calendar.DAY_OF_MONTH, mDay);
  
          DatePickerDialog dpd = 
              new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() {
                  @Override
                  public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                      Calendar cal = Calendar.getInstance();
  
                      //     Calendar cal = new GregorianCalendar();
  
                      cal.set(Calendar.MONTH, monthOfYear);
                      cal.set(Calendar.DAY_OF_MONTH, dayOfMonth);
                      cal.set(Calendar.YEAR, year);
                      if (cal.before(c)) {
                          Toast.makeText(getActivity(), "Select valid date please.", Toast.LENGTH_LONG)
                               .show();
                          return;
                      }
  
                      StringBuilder date = new StringBuilder();
                      date.delete(0, date.length());
                      date.append(year)
                          .append("-")
                          .append((monthOfYear + 1) &lt; 10 ? "0" : "")
                          .append((monthOfYear + 1))
                          .append("-")
                          .append((dayOfMonth &lt; 10 ? "0" : ""))
                          .append(dayOfMonth);
  
                      CheckInDate.setText(date.toString());
                  }
              }, mYear, mMonth, mDay);
          dpd.getDatePicker().setMinDate(c.getTimeInMillis());
          dpd.show();
      }
  
  };
  </code></pre>