title: Java Convert GMT/UTC to Local time doesn't work as expected
body: <p>In Order to show a reproducible scenario, I am doing the following</p>
  
  <ol>
  <li><p>Get the current system time (local time)</p></li>
  <li><p>Convert Local time to UTC // Works Fine Till here</p></li>
  <li><p>Reverse the UTC time, back to local time. Followed 3 different approaches (listed below) but all the 3 approaches retains the time in UTC only.</p>
  
  <p>{</p>
  
  <pre><code>long ts = System.currentTimeMillis();
  Date localTime = new Date(ts);
  String format = "yyyy/MM/dd HH:mm:ss";
  SimpleDateFormat sdf = new SimpleDateFormat (format);
  
  // Convert Local Time to UTC (Works Fine) 
  sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
  Date gmtTime = new Date(sdf.format(localTime));
  System.out.println("Local:" + localTime.toString() + "," + localTime.getTime() + " --&gt; UTC time:" + gmtTime.toString() + "-" + gmtTime.getTime());
  
  // Reverse Convert UTC Time to Locale time (Doesn't work) Approach 1
  sdf.setTimeZone(TimeZone.getDefault());        
  localTime = new Date(sdf.format(gmtTime));
  System.out.println("Local:" + localTime.toString() + "," + localTime.getTime() + " --&gt; UTC time:" + gmtTime.toString() + "-" + gmtTime.getTime());
  
  // Reverse Convert UTC Time to Locale time (Doesn't work) Approach 2 using DateFormat
  DateFormat df = new SimpleDateFormat (format);
  df.setTimeZone(TimeZone.getDefault());
  localTime = df.parse((df.format(gmtTime)));
  System.out.println("Local:" + localTime.toString() + "," + localTime.getTime() + " --&gt; UTC time:" + gmtTime.toString() + "-" + gmtTime.getTime());
  
  // Approach 3
  Calendar c = new GregorianCalendar(TimeZone.getDefault());
  c.setTimeInMillis(gmtTime.getTime());
  System.out.println("Local Time " + c.toString());
  </code></pre>
  
  <p>}</p></li>
  </ol>