Hi I am trying to get to grips with Java Calendar class (and the TimeZone class). I have noted some very weird behaviour though:
Try the following: 1) Bring up the Date and Time Properties window in Windows XP and select the timezone (GMT -03:00) Montevideo. Leave the DST box unchecked, click Apply. Now run the application code seen at the bottom of this post. Note in Java output how Java identifies the timezone as "GMT-03:00" and also outputs the time as being the same as the Windows OS time. Correct behaviour according to me! 2) Click to check the DST box and then click Apply. Now run the application code seen at the bottom of this post again. Note in Java output that Java identifies the timezone as "GMT" and also outputs the time as being 3 hours more than it was when using DST. Java's time is now not correlated with Windows time. WHAT IS GOING ON HERE??? Montevideo has got +1 hour DST time, not 3 hours. And how can Java identify it as GMT when it really should be GMT-3. Montevideo is not the only timezone that is identified as "GMT" when DST is enabled. For example also "(GMT+04:00) Baku" and "(GMT+02:00) Beirut" are also identified as "GMT" when DST is enabled. I am confused by Java time management to say the least. If anyone has any idea of what is going on here I would really appreciate some help. public class TimeTestMain { public static void main(String[] args) { test(); } private static void test(){ Calendar cal = Calendar.getInstance(); TimeZone tz = cal.getTimeZone(); System.out.println("TimeZone info: " + tz); System.out.println("time in " + tz.getDisplayName() + " is: " + cal.getTime().toString()); } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en -~----------~----~----~----~------~----~------~--~---