Name: mc57594 Date: 05/22/97
The following code, which runs correctly under JDK 1.0.2 and
current web browsers (Netscape 3.01 and Microsoft IE 3),
shows that the JDK1.1 implementation of Date.toGMTString()
incorrectly applies the adjustment for daylight saving time,
rather than leaving GMT as GMT.
This may also affect java.text.SimpleDateFormat
// This is JDK 1.0.2 code, but I believe the problem with JDK 1.1
// executing it is due to the java.text.SimpleDateFormat class
import java.util.Date;
import java.applet.Applet;
public class TestGMT extends Applet {
public void init () {
main(new String[0]);
}
public static void main (String[] args) {
// First one is OK under all systems (JDK 1.0.2 and JDK1.1 and
// Netscape 3.0.1 and Microsoft Explorer 3)
long noon28Mar1997 = 859550400000L;
System.out.println ((new Date (noon28Mar1997)).toGMTString());
// This one prints as 13:00 under JDK 1.1, 12:00 on all others
long noon30Mar1997 = noon28Mar1997 + 2 * 24 * 3600 * 1000;
System.out.println ((new Date (noon30Mar1997)).toGMTString());
}
}
company - R-cube Systems Limited , email - ###@###.###
======================================================================
- duplicates
-
JDK-4064735 TimeZone.getTimeZone("GMT") returns GMT with Daylight Saving Time adjustment
-
- Closed
-