title: How to convert datepicker format to dd-MM-yyyy
body: <p>In my database table I use a date format which inserts dates like <code>04-04-2015</code>.
  Then using a datePicker through variable <code>from_date</code> I choose the same date and that date is like <code>4-4-2015</code>. If I want to select rows using the date selected 
  from datepicker I get no rows even though rows are available. How can I change the 
  datePicker date to <code>04-04-2015</code> from <code>4-4-2015</code>, or insert the date like
  <code>4-4-2015</code> instead of <code>04-04-2015</code>?</p>
  
  <pre><code>private DatePickerDialog.OnDateSetListener myDateListener = new DatePickerDialog.OnDateSetListener() {
      @Override
      public void onDateSet(DatePicker arg0, int year, int month, int day) {
          dateView.setText(new StringBuilder()
              // Month is 0 based so add 1
              .append(day).append("-") //day
              .append(month+1).append("-")//month
              .append(year).append(" "));//year
          from_date=dateView.getText().toString();
          startActivity(new Intent(datefrom.this, dateto.class));
      }
  };
  </code></pre>
  
  <p>Code for insertion:</p>
  
  <pre><code>contentvalues.put(VivzHelper.TX_DATE, new SimpleDateFormat("dd-MM-yyyy").format(new Date()));
  </code></pre>