JDK-4052638 : GetTimeInstance returns wrong values in some timezones
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 1.1.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_95
  • CPU: x86
  • Submitted: 1997-05-16
  • Updated: 1997-10-23
  • Resolved: 1997-10-23
Related Reports
Duplicate :  
Description
Name: mc57594			Date: 05/16/97


I use JDK1.1.1 on Windows 95 / NT (same problem with 1.1FCS)

I run the program at the end of the page.
If I have my OS-timezone to, for example, western europe,
getTimeInstance returns PST time on '95, the right time on
NT.

If I include the TimeZone.getDefault lines, I get GMT time
(Western Europe is GMT+1), both on '95 and NT

If I run java with -Duser.timezone=ECT, both lines return the
right time, both on '95 and NT

import java.text.DateFormat;
import java.util.TimeZone;
import java.util.Date;

public class DateTest {
    public static void main(String args[]) {
        Date now = new Date();
        DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.FULL);
        String dateTimeString = dateFormat.format(now);
        System.out.println("getTimeInstance returns     : " + dateTimeString);
        dateFormat.setTimeZone(TimeZone.getDefault());
        dateTimeString = dateFormat.format(now);
        System.out.println("Timezone.getDefault returns : " + dateTimeString);
    }
}


======================================================================

Comments
WORK AROUND Name: mc57594 Date: 05/16/97 use java -Duser.timezone=<timezone> ======================================================================
11-06-2004