Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Daylight Saving Time

Thread view: 
www - 05 Mar 2007 21:46 GMT
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.
Mark Thornton - 05 Mar 2007 22:10 GMT
> Hi,
>
[quoted text clipped - 15 lines]
> 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
www - 06 Mar 2007 13:29 GMT
 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 - 06 Mar 2007 13:31 GMT
 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.
Larry Barowski - 06 Mar 2007 13:41 GMT
> 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.
www - 06 Mar 2007 16:15 GMT
> 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?
John Maline - 06 Mar 2007 16:56 GMT
>> You need a newer version of Java.
>
[quoted text clipped - 5 lines]
>
> 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.
Oliver Wong - 06 Mar 2007 17:32 GMT
>> You need a newer version of Java.
>
[quoted text clipped - 5 lines]
>
> 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
Chris Uppal - 06 Mar 2007 18:07 GMT
> > You need a newer version of Java.
>
[quoted text clipped - 3 lines]
> 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
Lew - 07 Mar 2007 02:13 GMT
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.

> 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
Chris Uppal - 07 Mar 2007 04:35 GMT
> www wrote:
> > > It is a big problem for some organizations that Java JVM fails to
[quoted text clipped - 10 lines]
> "several people [who] have been busy working on this [non-]issue" might
> be out of jobs.

:)

I welcome the absence of competition...

   -- chris
Larry Barowski - 07 Mar 2007 15:47 GMT
>> You need a newer version of Java.
>
[quoted text clipped - 4 lines]
>
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.