title: I want to convert string to date in java
body: <p>I have a string like <code>&quot;hh:mm:ss.SSSSSS&quot;</code> and I want to convert this string to <code>Date</code> and I want to get <code>&quot;hh:mm:ss.SS&quot;</code>. However, when I compile my code, it still gives the day month year time and timezone like <code>&quot;Thu Jan 01 10:50:55 TRT 1970&quot;</code>. I attached my code below to the text.</p>
  <pre><code>String a = &quot;20:50:45.268743&quot;;
  Date hour;
  try {
      hour = new SimpleDateFormat(&quot;hh:mm:ss.SS&quot;).parse(a);
      System.out.println(hour);
  } catch(ParseException e) {
      e.printStackTrace();
  }
  </code></pre>
  <p>My output is hu Jan 01 20:55:13 TRT 1970 but I want to get 20:55:45.26.<br />
  Is there anyone who can help me about this situation?</p>