title: How to convert a Calendar object to an Instant?
body: <p>I have a  <code>Calendar</code> object manipulated according to my needs, but converting it to <code>Instant</code> is not giving me the correct result:</p>
  
  <pre><code>Calendar cal = Calendar.getInstance(); // creates calendar
  cal.setTime(inputFiledate); // sets calendar time/date --&gt; inputFiledate is 29-12-2015
  cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(inputFileHour)); --&gt;inputFileHour is 5
  cal.set(Calendar.MINUTE, 0);
  cal.set(Calendar.SECOND, 0);
  cal.set(Calendar.MILLISECOND, 0);
  cal.add(Calendar.HOUR_OF_DAY,3); // adds  hours that is now time is 29-12-2015 08:00:00
  System.out.println("Date after manipulation "+cal.getTime()); --&gt;Displays 
  TimeZone tz = TimeZone.getTimeZone("UTC");
  
  // set the time zone with the given time zone value 
  // and print it
  cal.setTimeZone(tz);
  // Date date = cal.getTime(); // returns new date object, one hour in the future
  Date d= cal.getTime();
  System.out.println("DAte to Instant "+ d.toInstant()); 
  System.out.println(" Calendar to Instant "+cal.toInstant());
  System.out.println("Date after manipulation2 "+cal.getTime());
  </code></pre>
  
  <p>This is the output:</p>
  
  <pre><code>Date after manipulation Tue Dec 29 08:00:00 IST 2015
  DAte to Instant 2015-12-29T02:30:00Z
  Calendar to Instant 2015-12-29T02:30:00Z
  Date after manipulation2 Tue Dec 29 08:00:00 IST 2015
  </code></pre>
  
  <p>In need to convert this Calendar object to instant but it is giving incorrect result 2015-12-29T02:30:00Z
  where as the output should be 2015-12-29T08:00:00Z
  Where m I going wrong?</p>
  
  <p>Also tried with <code>Zoned datetime</code>, with <code>Timezone</code>, in vain.</p>