title: The correct way to set and get hour, minutes, sec
body: <p>I am trying to get some information out of a database and then using that information to get some statistics.</p>
  
  <p>I want to get statistics based on an interval of hours, therefore I have a created a <code>HashSet</code> made up of two <code>Integer</code>s hour and data.</p>
  
  <p>In order to get the correct hour I need to get the time out of the database. Therefore I need to create some sort of data / calendar object.</p>
  
  <p>Now since <code>Date</code> has been deprecated I need to find a new way to set the hours.</p>
  
  <p>Does anyone know how i can achive this?</p>
  
  <p>So far this solution works:</p>
  
  <pre><code>Calendar time = Calendar.getInstance();
          time.setTime(new Date(2012, 11, 12, 8, 10));    
          int hour = time.get(Calendar.HOUR);
          System.out.println(hour);
  </code></pre>
  
  <p>But as stated above date has been deprecated so I want to learn the "correct" way to do it.</p>