title: How to set Calendar object to current date but time from SimpleDateFormat that contains HH:mm:ss
body: <p>I need to create a new <code>Calendar</code> object that contains the current date but the time needs to be set from a given String of format <code>HH:mm:ss</code>.</p>
  
  <p>I create a new calendar object with current date and time  and then use a <code>SimpleDateFormat</code> object to parse the string and set the time from that one but that only overwrites the calendar object with the parsed time and Jan 1 1970:</p>
  
  <pre><code>def currentTime = new java.util.Date();
  Calendar calendar1 = Calendar.getInstance();
  calendar1.setTime(currentTime);
  java.util.Date inTime = new SimpleDateFormat("HH:mm:ss").parse(initialTime);
  calendar1.setTime(inTime);
  </code></pre>
  
  <p>Is there a way to get the values of Hour, Minute, Seconds and Milliseconds from the Date object to use it with <code>calendar.set(Calendar.HOUR_OF_DAY, hour)</code>, etc.? </p>