Results 1 to 2 of 2
  1. #1
    vincent_rig is offline Member
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Default Calendar differences between timezones

    Hi all,

    I notice some differences when running the piece of code below in different timezones. When I run by default I get following output:

    Wed Apr 06 16:41:27 CEST 2011

    When I change my timezone to -Duser.timezone=Asia/Jerusalem and run again, I get:

    Wed Apr 06 16:50:48 IDT 2011

    I would expect to perhaps get 1 hour difference since CEST is UTC+2 and IDT is UTC+3, but I do not understand why I get 9 minutes 21 seconds difference?

    Both runs happen on the same machine with the same JDK (1.6.0_21).

    Any ideas that could help me on my way?

    Java Code:
    Calendar c = Calendar.getInstance();
    c.setTimeInMillis(1302100887096);
    Date date = c.getTime();
    System.out.println(date);

  2. #2
    vanslyke is offline Member
    Join Date
    Jun 2011
    Posts
    1
    Rep Power
    0

Similar Threads

  1. Generics Differences?
    By castiel in forum New To Java
    Replies: 2
    Last Post: 02-21-2011, 11:11 AM
  2. Boosting differences
    By belsen in forum Lucene
    Replies: 0
    Last Post: 11-24-2010, 09:26 AM
  3. Timezones
    By Shaolin in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 08-27-2008, 06:54 AM
  4. differences: AWT and Swing
    By baltimore in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 09:01 AM
  5. differences between 2 dates
    By cecily in forum New To Java
    Replies: 1
    Last Post: 08-02-2007, 05:37 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
  •