title: Set time to 00:00:00
body: <p>I have a problem resetting hours in Java. For a given date I want to set the hours to 00:00:00.</p>
  
  <p>This is my code : </p>
  
  <pre><code>/**
       * Resets milliseconds, seconds, minutes and hours from the provided date
       *
       * @param date
       * @return
       */
      public static Date trim(Date date) {
          Calendar calendar = Calendar.getInstance();
          calendar.setTime(date);
          calendar.set(Calendar.MILLISECOND, 0);
          calendar.set(Calendar.SECOND, 0);
          calendar.set(Calendar.MINUTE, 0);
          calendar.set(Calendar.HOUR, 0);
  
          return calendar.getTime();
      }
  </code></pre>
  
  <p>The problem is that sometimes the time is <code>12:00:00</code> and sometimes it is <code>00:00:00</code> and when I query the database for an entity that was saved on <code>07.02.2013 00:00:00</code> and the actual entity time, that is stored, is <code>12:00:00</code> the query fails. </p>
  
  <p>I know that <code>12:00:00 == 00:00:00</code>! </p>
  
  <p>I am using AppEngine. Is this an appengine bug, problem or some other issue?  Or does it depend on something else?</p>