title: SimpleDateFormat parse for time
body: <p>i need to parse a String value and get it as date object. Am using the following snippet</p>
  
  <pre><code>  java.util.Date temp = new SimpleDateFormat("HH:mm:ss").parse("14:58:00");
  </code></pre>
  
  <p>My output is : <code>Thu Jan 01 14:58:00 IST 1970</code></p>
  
  <p>But what i need is only <code>14:58:00</code> as Date object is there any way to achieve this? If not what is the other way around? Please help.</p>
  
  <p><strong>EDIT</strong>
  I need this way because,</p>
  
  <p>I have a Jspinner(in a Jpanel) for selecting time in HH:mm:ss format . The scenario is I will open the JPanel to select the time and click on save button so the values selected will be saved in a variable(x).Now if i open the Jpanel again the previously selected values should be shown which will be read from the variable(x).</p>
  
  <p>For this am using following code,</p>
  
  <pre><code>    SpinnerModel Startmodel = new SpinnerDateModel();
      StarttimeSpinner = new JSpinner(Startmodel);
      Date date = new SimpleDateFormat("HH:mm:ss").parse("14:58:00");
      StarttimeSpinner.setValue(date);
  </code></pre>
  
  <p>On parse line am facing the problem. where i need only time(14:58:00) as date object.</p>
  
  <p><strong>NOTE:</strong>
  I have tried the below code( it will work but wont allow us to change value again)</p>
  
  <pre><code>    StarttimeSpinner = new JSpinner();
      Date time = new SimpleDateFormat("HHmmss", Locale.ENGLISH).parse("000000");
      SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
      String dateString = formatter.format(time);
      StarttimeSpinner.setModel(new SpinnerListModel(new String[]{dateString}));
  </code></pre>