Determine if the problem is related to the SDK
IBM® WebSphere® Application Server test using time.jsp. To test
the SDK:
- Deploy the time.jsp file, (see attachment) to an existing
application.
- To run time.jsp, put the file in the
install_root/installedApps/node
name/EAR directory/WAR
directory for an existing application.
- Request time.jsp from a browser. The results display in the
browser and are written to the application server stdout
file.
Results of running time.jsp in the stdout
file
In the stdout file, after time.jsp is run, the
following information displays:
[4/9/04 12:43:15:181 EDT] 58c81942
SystemOut U Fri Apr 09 12:43:15 EDT 2004
[4/9/04 12:43:15:181 EDT] 58c81942
SystemOut U java.util.SimpleTimeZone[id=America/New_York,
offset=-18000000,
dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,
startMonth=3,startDay=1,startDayOfWeek=1,startTime=7200000,
startTimeMode=0,endMode=2,endMonth=9,
endDay=-1,endDayOfWeek=1,
endTime=7200000,endTimeMode=0]
[4/9/04 12:43:15:181 EDT] 58c81942
SystemOut U America/New_York [4/9/04 12:43:15:181 EDT] 58c81942
SystemOut U Eastern Standard Time
[4/9/04 12:43:15:181 EDT] 58c81942 SystemOut
U Currently in daylight-savings time.
Java program test using Time Test.class
- Copy the TimeTest.class file, attached to this technote, to
the following directory:
install_root/java/bin
- At the command prompt, type:
java TimeTest
- It may be necessary to recompile the TimeTest.java file.
Results of TimeTest
Fri Apr 09 12:45:11 EDT 2004
java.util.SimpleTimeZone[id=America/New_York,offset=-18000000,
dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,
startMonth=3,startDay=1,startDayOfWeek=1,startTime=7200000,
startTimeMode=0,endMode=2,endMonth=9,
endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]
America/New_York Eastern Standard Time
Currently in daylight-savings time.
Gathering System Information
Determine the timezone setting that the operating system is using. For
Windows® systems, the date and time properties display the timezone. For
UNIX® systems, issue the following command from a command prompt to
display the timezone:
echo $TZ
Displaying the current values that the JVM™ is using
The attached JSP™ file, time.jsp, can be deployed on any
application that shows symptoms of reporting the incorrect time. When
time.jsp is called, it returns the following values:
- Current date and time
- Timezone ID
- Long name of the timezone in use
- Currently in/not in daylight-savings time.
- A table of Timezone Information that is available with the
SDK that is in use.
java.util.SimpleTimeZone output fields are described
below:
ID |
A String giving the timezone identifier (e.g., America/New_York) |
offset |
An integer field giving the offset in milliseconds from GMT (or UTC). The
number represents the number of milliseconds that must be added to GMT
time to obtain the time in this zone. For example, the US/Eastern zone has
a value of -18000000. To determine the offset in hours, offset =
-18000000/( 60 * 60 * 1000). |
dstSavings |
An integer field giving the additional offset from GMT (or UTC) in
milliseconds. (The time is calculated as offset + GMT). |
useDaylight |
Boolean field set to indicate if the timezone switches to DST. |
startYear |
An integer indicating the year in which the specified daylight savings
time rule took effect. |
startMonth |
An integer field giving the month of the year in which daylight savings
time starts. 0/January, 1/February, 2/March, 3/April, 4/May, 5/June,
6/July, 7/August, 8/September, 9/October, 10/November, 11/December. |
startDay |
An integer giving the daylight savings ending day of the week occurrence
in the month; where 1 means first occurrence, 2 means second, -1 means
last occurrence, -2 means second to last occurrence, and so on.
Note that when startDayOfWeek is zero, this field represents a specific
date in the month. Moreover, if startDayOfWeek is negative, this field
indicates the day of the month after which the day of the week indicated
by the absolute value of startDayOfWeek marks the start of daylight
savings time. |
startDayOfWeek |
An integer field indicating the day of the week for ending daylight
savings time, where 1 is Sunday and 7 is Saturday. There are some twists
allowed as indicated in the startDay description above. |
startTime |
An integer field giving the time of day in milliseconds, starting at
midnight, at which daylight savings time starts. (startTime = 7200000 / 60
* 60 * 1000). |
endMonth |
Same as startMonth, but for the end of daylight savings time. |
endDay |
Same as startDay, but for the end of daylight savings time. |
endDayOfWeek |
Same as startDayOfWeek, but for end of daylight savings time. |
endTime |
Same as startTime, but for end of daylight savings time. |
Modifying the WebSphere Application Server command line arguments to
use a specific timezone
If you want to specify a specific timezone that is not the same as the
operating system, set the following command line argument:
-Duser.timezone=ID
An example of setting the timezone to America/Los_Angeles is:
-Duser.timezone=America/Los_Angeles
Valid timezone values display in a table when time.jsp is
requested. |