title: Java While Loop With Time
body: <p>How can I use <a href="https://stackoverflow.com/a/37894707/6482242">This post</a> to work with a while loop to do a specific task between certain times (eg with pseudo code: </p>
  
  <p><code>while time &gt; 05:00 &amp;&amp; time &lt; 16:59</code></p>
  
  <p>I understand that I need to change these to ints after the input, I'm just not sure how to do the actual while loop.</p>
  
  <p>I've changed them to ints in the following way:</p>
  
  <pre><code>String hoursString = time.substring(0,1);
  String minutesString = time.substring(3,4);
  
  int hours = Integer.parseInt(hoursString);
  
  int minutes = Integer.parseInt(minutesString);
  </code></pre>
  
  <p>Edit: </p>
  
  <p>Thank you all so much for your help, I went with another direction of if statements that check the less than and more than conditions of the time. :)</p>
  
  <pre><code>if ((hours &gt;= 05) &amp;&amp; (hours &lt;= 16) { do stuff}
  </code></pre>
  
  <p>That's what I went with. ^</p>