Why does Java return a date in GMT-4.5 when choosing a coordinated universal time zone on Windows?

We saw a strange problem on some Windows XP machines with the Coordinated Universal Time time zone. Not all Windows XP machines seem to have this, but on those that do, the next simple Java program

public class TimeTest {
    public static void main(String[] args) {
        System.out.println(java.util.TimeZone.getDefault());
        System.out.println(new java.util.Date());
    }
}

on JDK 1.6.0_06:

sun.util.calendar.ZoneInfo [id = "America / Caracas", offset = -16200000, dstSavings = 0, useDaylight = false, transitions = 5, lastRule = null]
Fri Nov 13 05:34:14 VET 2009

(i.e. 4 and a half hours behind GMT). I must add that I live in London and have never been to South America. :-)

My questions:

  • Where does Java get this timezone? I thought coordinated universal time should be the new name for GMT.
  • Windows , ?
+5
3

Java, (VET), Windows ​​ Pacific. VMWare. Pacific , , Pacific, , Java, Java .

+3

, . "" UTC, . , , , . XP, - , Java -.

java.util.TimeZone.getDefault, , VET .

, UTC, , ... Joda Time Date/Calendar.

EDIT: .NET 3.5 , , , :

using System;

class Test
{
    static void Main()
    {
        Console.WriteLine(TimeZoneInfo.Local.DisplayName);
    }
}
0

Unix/Solaris. date Time/Zome, "date -u 042315232010". -u comand, TZ, GMT TZ. "date 042315232010", . , TimeZone Java-. , " 042315232010" " 23 15:23:00 VET 2010".

0

All Articles