title: In Java, How to check if time is within two Date objects
body: <p>I am trying to create a method in Java that returns true if the current time of day is between a set interval (startTime and endTime). </p>
  
  <p>The date is irrelevant.  What is the best way to do this?</p>
  
  <p>Here is my attempt it doesn't work:</p>
  
  <pre><code>public boolean isNowBetweenDateTime()
  {
      final Date now = new Date();
      return now.after(startTime) &amp;&amp; now.before(endTime);
  }
  </code></pre>
  
  <p>What is the best way (in java) to check if time is within two Date objects, ignoring year, month day?</p>