Results 1 to 5 of 5
  1. #1
    yzaltz is offline Member
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    Default Time Zone Problem on Windows

    I created a simple java test application that echo the time zone and the current date/time (to test Cruise controll problem).
    and it prints out the wrong time zone GMT-05:00 instead of GMT+02:00
    needless to say the Server I'm running has the right time and Time Zone set.

    Running with Java jdk1.6.0_03
    On Windows server 2003

    output:
    Acre Time:
    Thu Dec 24 06:24:41 ACT 2009:
    where DOS shell prints
    >time
    The current time is: 13:24:47.33


    My script is as follows:
    import java.util.Date;
    import java.util.TimeZone;

    public class TestDate{
    public static void main(String[] args){
    Date date = new Date();
    TimeZone tz = TimeZone.getDefault();
    String tzName = tz.getDisplayName(tz.inDaylightTime(date), TimeZone.LONG);

    System.out.println(tzName + ": ");
    String bla = date.toString();
    System.out.println(" " + bla + ":");
    }
    }



    Please advice

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    what about if you force the timezone with a Java VM argument:
    Java Code:
    java -Duser.timezone=US/Eastern CLASS_NAME
    Except, what ever code is for GMT+2 for you

  3. #3
    yzaltz is offline Member
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    Default Foring the time Zone

    for my little script it is not a problem to set the time Zone but the problem is that
    I did this test to test Cruise Control which is written in Java and uses a lot of modules like log4j that I can't control
    I'm trying to understand where java takes the odd time zone on the system obviously not directly from the OS

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    It works for me (Java 1.6.0.16) GMT+1; can you (double) check the timezone on the computer you're running that Java application on? (click on the clock in the bottom right corner); I'm not aware of timezone bugs w.r.t. that Acre (Brazilian AST) time.

    kind regards,

    Jos

  5. #5
    ayxayx is offline Member
    Join Date
    Sep 2010
    Posts
    1
    Rep Power
    0

    Default

    I have the same problem but i'am running a JVM 1.5_16 on a Windows Server 2008 x64. Does somebody have a solution for this Problem?

    Cheers

Similar Threads

  1. Problem in knowing the status of windows
    By sushil in forum Advanced Java
    Replies: 1
    Last Post: 10-05-2009, 09:35 PM
  2. Problem in knowing the status of windows
    By sushil in forum AWT / Swing
    Replies: 1
    Last Post: 10-04-2009, 01:48 AM
  3. Time zone stamp
    By ddscart in forum New To Java
    Replies: 1
    Last Post: 08-02-2009, 08:41 PM
  4. time Zone
    By mohammedsiddig in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 09-07-2008, 03:38 PM
  5. Replies: 0
    Last Post: 11-06-2007, 02:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •