Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4052638

GetTimeInstance returns wrong values in some timezones

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • 1.1.1
    • core-libs
    • None
    • x86
    • windows_95

    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);
          }
      }


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

      Attachments

        Issue Links

          Activity

            People

              ssenthilsunw Shanmugam Senthil (Inactive)
              mchamnessunw Mark Chamness (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: