title: how to save the selected date in the database
body: <p>I am trying to save the selected date in the database.
   I did that with the help of date picker, now i need to save it in the database.
  How to do that? How to get the selected date and store it in the database? Can any one help to me?</p>
  
  <pre><code>DatePickerDialog.OnDateSetListener startdate=new DatePickerDialog.OnDateSetListener() { 
      public void onDateSet(DatePicker view, int year, int monthOfYear, 
              int dayOfMonth) { 
          dateAndTime.set(Calendar.YEAR, year); 
          dateAndTime.set(Calendar.MONTH, monthOfYear); 
          dateAndTime.set(Calendar.DAY_OF_MONTH, dayOfMonth);                 
      } 
  };  @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.addtask);       
  
          Button startbtn=(Button)findViewById(R.id.AddStartButton);
          startbtn.setOnClickListener(new View.OnClickListener() { 
              public void onClick(View v) { 
                  new DatePickerDialog(AddTask.this,startdate, 
                          dateAndTime.get(Calendar.YEAR), 
                          dateAndTime.get(Calendar.MONTH), 
                          dateAndTime.get(Calendar.DAY_OF_MONTH)).show();             
                  } 
  
          private DatePickerDialog.OnDateSetListener startdate = new DatePickerDialog.OnDateSetListener() {
  
              // onDateSet method
              public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
              String date_selected = String.valueOf(monthOfYear+1)+" /"+String.valueOf(dayOfMonth)+" /"+String.valueOf(year);
              Toast.makeText(AddTask.this, "Selected start Date is "+date_selected, Toast.LENGTH_SHORT).show();
  
              }
              };   
  </code></pre>
  
  <p>Thank you.</p>