title: how to save datepicker value to sqlite database
body: <p>I have a problem about datepicker feature. </p>
  
  <p>How to save the value of datepicker to sqlite database?</p>
  
  <p>Assume I create a button to set the date and a button to save to database...</p>
  
  <p>main.java</p>
  
  <pre><code>public class main extends Activity implements OnClickListener {
  
  private Calendar dateTime=Calendar.getInstance();
        private SimpleDateFormat dateFormatter = new SimpleDateFormat("MMMM dd, yyyy");
  
   @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.addshoppinglist);
  
          mSaveBttn = (Button) findViewById(R.id.saveBttn);
          mSetDateBttn = (Button) findViewById(R.id.shoppingDate);
          mCancelBttn = (Button) findViewById(R.id.cancelBttn);
          mSaveBttn.setOnClickListener(this);
  
          mSetDateBttn.setOnClickListener(this);
          mCancelBttn.setOnClickListener(this);
          helper = new ProductDatabaseHelper(this);
          model = helper.getAll();
      }
      public void onClick(View v) {
          // TODO Auto-generated method stub
          switch (v.getId()) {
          case R.id.saveBttn:
  
  
              break;
  
          case R.id.cancelBttn:
              Intent mainIntent = (new Intent(AddShoppingList.this, main.class));
              startActivity(mainIntent);
  
              break;
  
          case R.id.shoppingDate:
              showDialog(DIALOG_DATE);
  
          }
      }
  protected Dialog onCreateDialog(int id){
          switch(id){
          case DIALOG_DATE:
              return new DatePickerDialog(this,new OnDateSetListener(){
  
  
                  public  void onDateSet(DatePicker view,int year,int monthOfYear,int dayOfMonth){
                      dateTime.set(year,monthOfYear,dayOfMonth);
  
                      mSetDateBttn.setText(dateFormatter
                              .format(dateTime.getTime()));
  
                  }
              } ,dateTime.get(Calendar.YEAR),
                dateTime.get(Calendar.MONTH),
                dateTime.get(Calendar.DAY_OF_MONTH));
  
  
  
          }
  
  }
  </code></pre>
  
  <p>Does anyone know how to save the date format to database?</p>