Daylight Saving Time

Discussion in 'Java' started by www, Mar 5, 2007.

  1. www

    www Guest

    Hi,

    This year's Daylight Saving Time rule is different in US. It is March
    11, the second Sunday in March, instead of 1st Sunday in April. I have
    written a small Java program to test if it is doing right.

    <pseudo-code>
    Set a date and time, like "2007-03-10 08:00:00"
    forward 24 hours
    print out the date and time
    </pseudo-code>

    I found that in Windows XP, output is correct(2007-03-11 09:00:00), but
    in linux, it is wrong(2007-03-11 08:00:00).

    I have heard that Java JVM gets its time from OS. Microsoft XP may have
    updated and RedHat Linux may not. Is this correct? If this case, why Sun
    is still providing a tool to fix the problem when Microsoft has already
    done it? See
    http://java.sun.com/javase/tzupdater_README.html

    Thank you very much.
    www, Mar 5, 2007
    #1
    1. Advertising

  2. www wrote:
    > Hi,
    >
    > This year's Daylight Saving Time rule is different in US. It is March
    > 11, the second Sunday in March, instead of 1st Sunday in April. I have
    > written a small Java program to test if it is doing right.
    >
    > <pseudo-code>
    > Set a date and time, like "2007-03-10 08:00:00"
    > forward 24 hours
    > print out the date and time
    > </pseudo-code>
    >
    > I found that in Windows XP, output is correct(2007-03-11 09:00:00), but
    > in linux, it is wrong(2007-03-11 08:00:00).
    >
    > I have heard that Java JVM gets its time from OS. Microsoft XP may have
    > updated and RedHat Linux may not. Is this correct? If this case, why Sun
    > is still providing a tool to fix the problem when Microsoft has already
    > done it? See


    Java gets the current UTC time from the operating system but calculates
    local time itself. Unlike Microsoft Windows, Java correctly computes
    historical local time offsets. In the case of the UK locale, it
    correctly gives the local time for the years when 'double daylight time'
    applied. In the US Java will continue to give the correct offset for
    dates last year as well as the updated rule for this year.

    Windows on the other hand uses the current offset for all dates. For
    example, during summer if you ask for the offset for a date/time during
    winter it will give a value as if daylight time applied! This is
    considered a feature (I think it is a bug).

    Mark Thornton
    Mark Thornton, Mar 5, 2007
    #2
    1. Advertising

  3. www

    www Guest

    Mark Thornton wrote:
    In the US Java will continue to give the correct offset for
    > dates last year as well as the updated rule for this year.
    >


    Thank you for your detailed reply. But I cannot understand the above
    sentence. Like I said earlier, at least in RedHat Linux, I have just
    tested. Java failed to forward one hour during March 11th, 2007.

    Many Java people are busy fixing this problem these days. Some people
    compare this with Y2K.
    www, Mar 6, 2007
    #3
  4. www

    www Guest

    Mark Thornton wrote:
    In the US Java will continue to give the correct offset for
    > dates last year as well as the updated rule for this year.
    >


    Thank you for your detailed reply. But I cannot understand the above
    sentence. Like I said earlier, at least in RedHat Linux, I have just
    tested. Java failed to forward one hour during March 11th, 2007. It
    forwards one hour on April 1st, 2007, which is wrong. It is old rule.

    Many Java people are busy fixing this problem these days. Some people
    compare this with Y2K.
    www, Mar 6, 2007
    #4
  5. "www" <> wrote in message
    news:esjqen$smc$...
    > Thank you for your detailed reply. But I cannot understand the above
    > sentence. Like I said earlier, at least in RedHat Linux, I have just
    > tested. Java failed to forward one hour during March 11th, 2007. It
    > forwards one hour on April 1st, 2007, which is wrong. It is old rule.


    You need a newer version of Java.
    Larry Barowski, Mar 6, 2007
    #5
  6. www

    www Guest

    Larry Barowski wrote:

    >
    > You need a newer version of Java.


    It is a big problem for some organizations that Java JVM fails to change
    Daylight Saving Time on March 11th, 2007. In my company, several people
    have been busy working on this issue. TV news has also been talking
    about this topic frequently. I don't think we are using an old version
    of Java.

    I am using Java 1.5. Which version are you using?
    www, Mar 6, 2007
    #6
  7. www

    John Maline Guest

    www wrote:
    > Larry Barowski wrote:
    >
    >>
    >> You need a newer version of Java.

    >
    > It is a big problem for some organizations that Java JVM fails to change
    > Daylight Saving Time on March 11th, 2007. In my company, several people
    > have been busy working on this issue. TV news has also been talking
    > about this topic frequently. I don't think we are using an old version
    > of Java.
    >
    > I am using Java 1.5. Which version are you using?
    >
    >


    Java 5 (a/k/a Java 1.5) had bad DST data when first released. Java 5
    Update 6 is the first patch of that version that had good DST data for
    the upcoming US change.

    Go to Sun's Java DST FAQ
    http://java.sun.com/developer/technicalArticles/Intl/USDST_Faq.html and
    read question 24.
    John Maline, Mar 6, 2007
    #7
  8. www

    Oliver Wong Guest

    "www" <> wrote in message
    news:esk42q$r8$...
    > Larry Barowski wrote:
    >
    >>
    >> You need a newer version of Java.

    >
    > It is a big problem for some organizations that Java JVM fails to change
    > Daylight Saving Time on March 11th, 2007. In my company, several people
    > have been busy working on this issue. TV news has also been talking
    > about this topic frequently. I don't think we are using an old version
    > of Java.
    >
    > I am using Java 1.5. Which version are you using?


    I don't know what version Larry Barowski is using, but 1.6 is the
    latest "official" release of Java. 1.7 is still in beta (or perhaps even
    alpha).

    - Oliver
    Oliver Wong, Mar 6, 2007
    #8
  9. www

    Chris Uppal Guest

    www wrote:

    > > You need a newer version of Java.

    >
    > It is a big problem for some organizations that Java JVM fails to change
    > Daylight Saving Time on March 11th, 2007. In my company, several people
    > have been busy working on this issue. TV news has also been talking
    > about this topic frequently. I don't think we are using an old version
    > of Java.


    Sun have released a tool for updating the timezone data files. It was on the
    main download page last time I looked.

    -- chris
    Chris Uppal, Mar 6, 2007
    #9
  10. www

    Lew Guest

    Larry Barowski wrote:
    >>> You need a newer version of Java.


    www wrote:
    >> It is a big problem for some organizations that Java JVM fails to change
    >> Daylight Saving Time on March 11th, 2007. In my company, several people
    >> have been busy working on this issue. TV news has also been talking
    >> about this topic frequently. I don't think we are using an old version
    >> of Java.


    Chris Uppal wrote:
    > Sun have released a tool for updating the timezone data files. It was on the
    > main download page last time I looked.


    Sssh. If the employer finds out that this is a solved problem all those
    "several people [who] have been busy working on this [non-]issue" might be out
    of jobs.

    -- Lew
    Lew, Mar 7, 2007
    #10
  11. www

    Chris Uppal Guest

    Lew wrote:

    > www wrote:
    > > > It is a big problem for some organizations that Java JVM fails to
    > > > change Daylight Saving Time on March 11th, 2007. In my company,
    > > > several people have been busy working on this issue. TV news has also
    > > > been talking
    > > > about this topic frequently. I don't think we are using an old version
    > > > of Java.

    >
    > Chris Uppal wrote:
    > > Sun have released a tool for updating the timezone data files. It was
    > > on the main download page last time I looked.

    >
    > Sssh. If the employer finds out that this is a solved problem all those
    > "several people [who] have been busy working on this [non-]issue" might
    > be out of jobs.


    :)

    I welcome the absence of competition...

    -- chris
    Chris Uppal, Mar 7, 2007
    #11
  12. "www" <> wrote in message
    news:esk42q$r8$...
    > Larry Barowski wrote:
    >
    >>
    >> You need a newer version of Java.

    >
    > It is a big problem for some organizations that Java JVM fails to change
    > Daylight Saving Time on March 11th, 2007. In my company, several people
    > have been busy working on this issue. TV news has also been talking about
    > this topic frequently. I don't think we are using an old version of Java.
    >
    > I am using Java 1.5. Which version are you using?


    Do a Google Search for java "daylight savings time" . On the
    first link that came up for me I found:

    Time zone data that adheres to the new DST rules is included in the
    following
    update releases of the Java platform:

    * 1.3.1_18
    * 1.4.2_11
    * 5.0_u6
    * 6

    There is also a download link for the zone updater tool that Chris
    mentioned.
    Larry Barowski, Mar 7, 2007
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pranav Kantawala
    Replies:
    5
    Views:
    737
    P.Hill
    Feb 25, 2004
  2. Filip Lyncker
    Replies:
    3
    Views:
    742
    Karl Heinz Buchegger
    Apr 5, 2005
  3. Pelle Beckman
    Replies:
    3
    Views:
    479
    Ioannis Vranos
    May 1, 2005
  4. mazdotnet

    Daylight saving time calculation

    mazdotnet, Oct 13, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    323
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tp?=
    Oct 15, 2006
  5. Harlan Messinger

    Dates, time zones,daylight saving time

    Harlan Messinger, Apr 15, 2010, in forum: ASP .Net
    Replies:
    1
    Views:
    1,003
    Eric Isaacs
    Apr 16, 2010
Loading...

Share This Page