Daylight Saving Time

W

www

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.
 
M

Mark Thornton

www said:
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
 
W

www

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.
 
W

www

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.
 
L

Larry Barowski

www said:
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.
 
W

www

Larry said:
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?
 
J

John Maline

www said:
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.
 
O

Oliver Wong

www said:
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
 
C

Chris Uppal

www said:
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
 
L

Lew

Chris said:
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
 
C

Chris Uppal

Lew said:
Chris said:
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
 
L

Larry Barowski

www said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top