JDK-4089103 : Many valid timezones not recognised
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 1997-10-28
  • Updated: 1998-03-02
  • Resolved: 1998-03-02
Related Reports
Duplicate :  
Description

Name: mf23781			Date: 10/28/97


Many strange effects noticed
Timezones not recognized (e.g. CET).
If TimeZone recognized then SimpleDateFormat displays it as
an offset from GMT (e.g. PST displayed as GMT-08:00)
GMT offset are not recognized (e.g. GMT-08:00) 

Test Program :

import java.util.*;
import java.text.*;

public class TestTime {

  public static void printTime (String tz) {
    TimeZone t = TimeZone.getTimeZone(tz);

    if (t != null) {
      GregorianCalendar testDate =
                new GregorianCalendar(t);

      SimpleDateFormat d = new SimpleDateFormat("HH:mm:ss zzzz");
      d.setTimeZone (t);
      System.out.println (tz + " - Date = "
                + d.format(testDate.getTime()));
    }
    else
      System.out.println (tz + " - No TimeZone");
  }

  public static void main (String[] args) {
    printTime ("GMT");
    printTime ("CET");
    printTime ("PST");
    printTime ("GMT-08:00");
  }
}


Produces the following results

$ java TestTime
GMT - Date = 16:09:12 Greenwich Mean Time
CET - No TimeZone
PST - Date = 08:09:13 GMT-08:00
GMT-08:00 - No TimeZone

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

Comments
WORK AROUND Name: mf23781 Date: 10/28/97 ======================================================================
11-06-2004