title: Strange Java Timezone Date Conversion Problem
body: <p>I want to convert <code>ms-since-1970-timestamp</code> to a date with timezone (Germany).</p>
  
  <p>Here are two variants of code which worked - at least, I remember using it and it worked:</p>
  
  <pre><code>import java.text.SimpleDateFormat;
  import java.util.Calendar;
  import java.util.Date;
  import java.util.GregorianCalendar;
  import java.util.Locale;
  import java.util.TimeZone;
  
  public class TestDate {
  
      public static void main(String[] args) {
          Calendar cal = GregorianCalendar.getInstance(TimeZone.getTimeZone("Germany"), Locale.GERMANY);
  
          Date d = new Date();
          cal.setTime(d);
  
          System.out.println(String.format("%02d.%02d.%04d %02d:%02d:%02d", 
                  cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH)+1, cal.get(Calendar.YEAR),
                  cal.get(Calendar.HOUR_OF_DAY),  cal.get(Calendar.MINUTE),  cal.get(Calendar.SECOND)));
  
          SimpleDateFormat df = new SimpleDateFormat( "dd.MM.yyyy HH:mm:ss.S" );
          df.setTimeZone(TimeZone.getTimeZone("Germany"));
          System.out.println(df.format(d));
      }
  
  }
  </code></pre>
  
  <p>It's really strange, because I couldn't find the reason for a time-difference of 2hours.</p>
  
  <p>It should be: <code>16:05:20</code>
  The code prints: <code>14:05:20</code> in both variants.</p>
  
  <p>Could someone please help me and tell me what went wrong here?</p>