title: Convert Java string to Time, NOT Date
body: <p>I would like to convert a variable string to a Time type variable, not Date using Java. the string look like this 17:40</p>
  
  <p>I tried using the code below but this instance is a date type variable not time</p>
  
  <pre><code>String fajr_prayertime  =       prayerTimes.get(0);
  DateFormat formatter = new SimpleDateFormat("HH:mm");
  fajr_begins = (Date)formatter.parse(fajr_prayertime);
  System.out.println(" fajr time " + fajr_begins);
  </code></pre>
  
  <p>However Netbean complains that I should insert an exception as below;</p>
  
  <pre><code>DateFormat formatter = new SimpleDateFormat("HH:mm");
  try {
  fajr_begins = (Date)formatter.parse(fajr_prayertime);
  } catch (ParseException ex) {
  Logger.getLogger(JavaFXApplication4.class.getName()).log(Level.SEVERE, null, ex);
  }
  System.out.println(" fajr time " + fajr_begins);
  </code></pre>
  
  <p>Any idea how I can get the time out of the string above.</p>