title: Getting time from String
body: <p>My Java code must get string "HH:MM" from console and needs to operate with it.
  is there possible to parse such time from string in order to add, for example,2 hours.</p>
  
  <pre><code>BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  
  System.out.print("Enter some time:");
  String enteredTime = in.readLine(); 
  // here I want to get time in some variable   
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>As result I have to get three dates and define is there three date between another dates .
  I understand that I can split string on parts and work with their, but I'm lloking for simple way to operate with such times.</p>
  
  <p>I found good solution:</p>
  
  <pre><code>SimpleDateFormat parser = new SimpleDateFormat("HH:mm");
  Date ten = parser.parse("10:00");
  Date eighteen = parser.parse("18:00");
  
  try {
      Date userDate = parser.parse(someOtherDate);
      if (userDate.after(ten) &amp;&amp; userDate.before(eighteen)) {
      ...
  }
  } catch (ParseException e) {
      // Invalid date was entered
  }
  </code></pre>