-
Bug
-
Resolution: Fixed
-
P3
-
1.1.1, 1.1.3, 1.1.4, 1.1.5
-
1.1.8
-
generic, x86, sparc
-
generic, solaris_2.6, windows_95
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2016104 | 1.2.0 | Alan Liu | P3 | Resolved | Fixed | 1.2beta3 |
Name: rlT66838 Date: 07/16/97
Run the following Java applet. Notice that the
time zone for the applet is the German time
zone, not that of the virtual machine. Changing
the locale in the program to en_US changes the
timezone to PST.
I'm executing this with the 1.1.3 appletviewer.
import java.text.*;
import java.awt.*;
import java.applet.*;
import java.util.*;
// Test Java locale-sensitive date formatting on output
public class TestDateFormat extends Applet {
Date curDate;
DateFormat shortdate, fulldate;
String strShortDate, strFullDate;
public void init () {
Locale curLocale = new Locale("de","DE");
Locale.setDefault(curLocale);
curDate = new Date();
shortdate = DateFormat.getDateInstance(DateFormat.SHORT);
fulldate = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG
);
strShortDate = new String("The current date (short form) is " + shortdate.
format(curDate));
strFullDate = new String("The current date (long form) is " + fulldate.for
mat(curDate));
}
public void paint(Graphics g) {
g.setColor(Color.black);
g.drawString(strShortDate,10,10);
g.drawString(strFullDate,10,30);
}
}
The HTML file is:
<HTML>
<HEAD>
<TITLE> Testing DateFormat </TITLE>
</HEAD>
<BODY>
This is the applet:<P>
<applet code="TestDateFormat.class" width=500 height=300>
<param name=Language value="de">
<param name=Territory value="DE">
</applet>
</BODY>
</HTML>
======================================================================
###@###.### - 1997-11-19 :
Related to this bug report is the following report
(Incident 20513, Bug 0129 on BetaSphere). I tested
the code with JDK1.2beta2 (1.2U) and found that the
bug is still reproducible. I think it should really
be fixed before JDK1.2 goes fcs next year, otherwise
international acceptance of Java is needlessly jeopardized.
SYNOPSIS : Incorrect timezone is reported when data converted by DateFormat.
DESCRIPTION : There is a bug with timezone printed in date format (Win95).
I have timezone GMT+6 but DateFormat displays time as tz = GMT+2
and allign time according to it. Date.toString() displays
correct timezone.
Sample program:
import java.text.*;
import java.util.*;
public class test_tz
{
public static void main(String aa[])
{
Date date = new Date();
System.out.println(date);
System.out.println(DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG).format(date));
}
}
======================================================================
- backported by
-
JDK-2016104 Setting default locale changes timezone for DateFormat
-
- Resolved
-
- duplicates
-
JDK-4060495 Time is Being Changed with Locale Change when using DateFromat
-
- Closed
-
-
JDK-4105204 DateFormat ignores setTimeZone; AppletViewer only, MST and Central (Indiana)only
-
- Closed
-