title: sqlite: how to insert time in sqlite database from android application
body: <p>I have two edittext when i click on it a timepickerdialog will popup and the time will set in edittext for that my code is,</p>
  
  <pre><code>  int TIME_PICKER_ID = 1,hour,minute,flag;
  
    edittext_starttime.setOnClickListener(this);
    edittext_endtime.setOnClickListener(this);
  
      final Calendar c = Calendar.getInstance();
      hour = c.get(Calendar.HOUR_OF_DAY);
      minute = c.get(Calendar.MINUTE);
  
    @Override
     public void onClick(View v) {
       if(v.getId() == R.id.editText_starttime_stsa){
          flag = 1;
          showDialog(TIME_PICKER_ID);
      }//editText_starttime_stsa
  
      if(v.getId() == R.id.editText_endtime_stsa){
          flag = 2;
          showDialog(TIME_PICKER_ID);
      }//editText_endtime_stsa
  
      if(v.getId() == R.id.button_create_stsa){
          onCreateAlert();
      }//button_create_susa       
  }
  
     @Override
  protected Dialog onCreateDialog(int id) {
      switch(id){
      case 1: 
  return new TimePickerDialog(this, timePickerListener, hour, minute, false);
      }
      return null;
  }
  
  private TimePickerDialog.OnTimeSetListener timePickerListener = new     TimePickerDialog.OnTimeSetListener(){
      public void onTimeSet(TimePicker view,int selectedHour,int selectedMinute){
          hour = selectedHour;
          minute = selectedMinute;
  
          updateDisplay(hour,minute);
      }
  };
  
  private void updateDisplay(int hour, int minute) {
      if(flag==1){
          edittext_starttime.setText(new StringBuilder().append(pad(hour)).append(":").append(pad(minute)));
      }else if(flag==2){
          edittext_endtime.setText(new StringBuilder().append(pad(hour)).append(":").append(pad(minute)));
      }
  }
  
  private static String pad(int c) {
      if (c &gt;= 10)
         return String.valueOf(c);
      else
         return "0" + String.valueOf(c);
  }
  </code></pre>
  
  <p>I want to insert start_time and end_time in the sqlite database for that i have written query,</p>
  
  <pre><code>String query = "insert into Status_Master(status_id, status_name, status_description,  timewindow_start, timewindow_end) values("+status_id+",'"+status_name+"','"+status_desc+"',time('"+start_time+"'),time('"+end_time+"'))";
  </code></pre>
  
  <p>But i am getting error. Is this the correct way to insert time in database?</p>