title: Convert time (hh:mm) to (yyyy-MM-dd HH:mm:ss)
body: <p>I have used time picker to select time.Now what i want is that i want to compare two time.
  Code for time picker.</p>
  
  <pre><code>public class TimePickerFragment extends DialogFragment implements
              TimePickerDialog.OnTimeSetListener {
          public int hour;
          public int min;
          public String time;
  
          @Override
          public Dialog onCreateDialog(Bundle savedInstanceState) {
              // TODO Auto-generated method stub
              final Calendar c = Calendar.getInstance();
  
              hour = c.get(Calendar.HOUR_OF_DAY);
              min = c.get(Calendar.MINUTE);
  
              // Create a new instance of DatePickerDialog and return it
              return new TimePickerDialog(getActivity(), this, hour, min, true);
  
          }
  
          @Override
          public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
              // TODO Auto-generated method stub
              time = String.valueOf(hourOfDay) + ":" + String.valueOf(minute);
  
              Intent intent = new Intent();
              intent.putExtra("TIME", time);
  
              getTargetFragment().onActivityResult(getTargetRequestCode(), 1,
                      intent);
              getDialog().hide();
  
          }
  
          public String onTimeSelected() {
              return time;
          }
  
      }
  </code></pre>
  
  <p>Now in intent i am geting time in thuis format("22.00").To compare time i want time in this format("yyyy-MM-dd HH:mm:ss").
  So how do i convert("22:00") to ("yyyy-MM-dd HH:mm:ss")????</p>
  
  <p>What i did</p>
  
  <pre><code>try {
                  String time = data.getStringExtra("TIME");
                  SimpleDateFormat sdf = new SimpleDateFormat(
                          "yyyy-MM-dd HH:mm:ss");
                  Date timeCompare;
                  timeCompare = sdf.parse(time);
                  Date currentTime = new Date();
                  int comareResult = timeCompare.compareTo(currentTime);
  
                  if (comareResult == -1) {
                       time = new SimpleDateFormat(" HH:mm").format(date.getTime());
                      etStartTime.setText(time);
                  } else {
                      Toast.makeText(mContext, "Your cannot select future time",
                              Toast.LENGTH_SHORT).show();
                  }
              } catch (ParseException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
          }
  </code></pre>