title: Conversion of local time zone to GMT in java
body: <p>Am trying convert date which is in local time zone to GMT,  i did some thing like this </p>
  
  <pre><code>SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
          sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
          String gmtStrDate = sdf.format(Calendar.getInstance().getTime());
  
          System.out.println("GMT 1"+gmtStrDate);
  
          Date gmtDate = sdf.parse(gmtStrDate);
  
          System.out.println("GMT 2"+gmtDate);
  </code></pre>
  
  <p>i am getting GMT 1 o/p in GMT tz but GMT 2 o/p is again changing to local time zone...Can any tel me why?</p>
  
  <p>to get the GMT 2 o/p in GMT i did like this :</p>
  
  <p>Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
              calendar.setTime(gmtDate);</p>
  
  <pre><code>        System.out.println("GMT 3 = "+calendar.getTime());
  </code></pre>
  
  <p>but still GMT 3o/p am getting in local tz. Please suggest on this.</p>