title: How can I check if date is before a specific time?
body: <p>I have to check, if a date variable is before a specific time. The variable has the format dd.MM.yyyy HH:mm:ss.  </p>
  
  <p>Let's take todays date 31.10.2016 15:20:45. The value of the variable is 30.10.2016 14:00:21. How can I check now if the variable is one day older than today and if the time is before or equals 23:00?</p>
  
  <p>I tried following code. </p>
  
  <pre><code>Date today = new Date(); 
  Calendar c = Calendar.getInstance(); 
  c.setTime(causedAt); 
  c.add(Calendar.DATE, 1); 
  if (c.getTime().compareTo(today) &lt; 0) { // It's more than 1 day.
      setOneDayOverdue(true); 
      setFiveDaysOverdue(false); 
  }
  </code></pre>
  
  <p>But with this code the part with the time is missing.  </p>
  
  <p>The solution should work with Java 7 and without any external libraries like Joda-Time.</p>