Ashik’s IT Thoughts

March 30, 2007

Year 2007 Daylight Savings Issue

Filed under: Uncategorized — ashikuzzaman @ 10:19 am

Daylight Saving Time (DST) is a system of handling the changing amounts of daylight throughout the year. The Energy Policy Act of 2005 mandates that DST will start on the second Sunday in March and end on the first Sunday in November. In 2007, the start and stop dates will be March 11 and November 4, respectively. These dates are different from previous DST start and stop dates. In 2006, the dates were the first Sunday in April (April 2, 2006) and the last Sunday in October (October 29, 2006). So your Java applications may have some consequences in this respect. For example, applications running on an older JRE may report incorrect time (1 hour difference to actual time) from March 11, 2007 through April 2, 2007 and from October 29, 2007 through November 4, 2007. In our product in office that uses both Sun and IBM JVM, we faced this issue and I had to work on it a little.

Sun fixed these problems in their later versions of JRE releases.

Java Standard Edition Minimum JRE version required
1.3 1.3.1_18
1.4 1.4.2_11
5 5.0_u6
6  

As part of investigation, I wrote a simple test program to print the current system time with Java SE 1.4.2_10, 1.4.2_11, 1.4.2_12 at 6:10 PM in 27th March which is within the daylight savings effect timeframe. Java SE 1.4.2_10 shows current time as <03/27/2007 05:10:11 PM> which is 1 hour less than correct time. But Java SE 1.4.2_11 and 1.4.2_12 showed the correct time <03/27/2007 06:10:11 PM> which proves they already have the 2007 DST change fixed.

public class JavaDateLightSavings {
public static void main (String []args) {
// Get system date
Date odate = new Date();
DateFormat formatter = new SimpleDateFormat(“MM/dd/yyyy hh:mm:ss a”);
System.out.println(“formatter.format(odate) : <” + formatter.format(odate) + “>”);
} }

IBM provided IBM Time Zone Update Utility for Java as a patch to fix this issue with its JREs. To my understanding, this tool actually looks inside each of these directories’ 2 sub-directories java\jre and _jvm\jre as all the timezone related information are inside jre\lib directory. So when we are talking about TimeZone issue with IBM WebSphere, this utility will essentially do operations on these 2 sub-directories. I downloaded the tool and gave a test run in DISCOVERONLY mode and found that it can operate in 2 ways. First, working on one JRE at a time where you have to select which IBM JRE you want to patch. Second, find out all the JREs that need to be patched by first searching the who system and when the tool shows the list of JREs available to fix, decide which of the JREs you want to patch. The patch is needed to be applied in both server-side’s AppServer and AppClient JREs.

Advertisements

1 Comment »

  1. Excellent site!

    Comment by All Things American — May 23, 2007 @ 9:15 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: