Name: mc57594 Date: 01/29/97
If you use the following code and live in the Mountain
Standard Time (MST) zone:
import java.util.*;
public class BugTest
{
public static void main (String[] args)
{
System.out.println((new Date()).toString());
}
}
and compile it with JDK 1.0.2, it will print out the date and time using
MST. Use the same byte-code with JDK 1.1 beta3, it reports the correct
time, except it uses PST (ie, if it was 12:30 MST, it would show 11:30
PST). If there was a good reason for this, please let us know.
If you print out the TimeZone IDs with the following program:
import java.util.TimeZone;
public class GMT
{
public static void main (String[] args)
{
String[] ids = TimeZone.getAvailableIDs();
for (int i = 0; i < ids.length; i++)
System.out.println(ids[i]);
}
}
You get the following:
GMT
ECT
EET
EAT
MET
NET
PLT
IST
BST
VST
CTT
JST
ACT
AET
SST
NST
MIT
HST
AST
PST
PNT
MDT <<<- This is the one that is WRONG, it needs to be "MST".
CST
EST
PRT
CNT
AGT
BET
CAT
======================================================================
ron.winacott@Canada 1997-02-26
import java.util.*;
public class BugTest
{
public static void main (String[] args)
{
System.out.println((new Date()).toString());
}
}
The above code prints the time as PST as opposed to EST which is the timezone we are in. It works with JDK1.0.2, however it does not under JDK1.1FCS. This problem is independant of the MST/MDT problem mentioned above.
- duplicates
-
JDK-4069784 TimeZone.getDefault() returns incorrect time zome.
-
- Closed
-