JDK-4085909 : No DST for UK time zone
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.1.4
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 1997-10-13
  • Updated: 1998-03-02
  • Resolved: 1998-03-02
Related Reports
Duplicate :  
Description

Name: joT67522			Date: 10/13/97


Now that you've (correctly) made GMT a constant timezone, you need a new zone for UK
 civil time which _does_ have DST.
At present, a Solaris JDK 1.1.4 system seems to assume that TZ=GB-Eire means GMT, which it doesn't.

Sample code:

--------8<--------
import java.util.*;
import java.text.DateFormat;

public class NoDST {
  public static void main(String[] args) {
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG,
						   DateFormat.LONG);
    System.out.println(df.format(new Date()));
    df.setTimeZone(TimeZone.getDefault());
    System.out.println(df.format(new Date()));
    // This tries to implement the following lines from
    // /usr/share/lib/zoneinfo/europe:
    //# Rule  NAME    FROM    TO      TYPE    IN      ON      AT      SAVE    LETTER/S
    //Rule    GB-Eire 1981    max     -       Mar     lastSun 1:00s   1:00    BST
    //Rule    GB-Eire 1996    max     -       Oct     lastSun 1:00s   0       GMT
    df.setTimeZone(new SimpleTimeZone(0, "GB-Eire",
				      Calendar.MARCH, -1, Calendar.SUNDAY,
				      3600000,
				      Calendar.OCTOBER, -1, Calendar.SUNDAY,
				      3600000));
    System.out.println(df.format(new Date()));
  }
}
--------->8--------
Demonstration:
---------8<--------
eddoe:~/tmp$ javac NoDST.java
eddoe:~/tmp$ echo $TZ
GB-Eire
eddoe:~/tmp$ java NoDST
October 13, 1997 1:01:32 PM PDT
October 13, 1997 8:01:32 PM GMT+00:00
October 13, 1997 9:01:32 PM GMT+01:00
eddoe:~/tmp$ date
Mon Oct 13 21:01:32 BST 1997
eddoe:~/tmp$ uname -a
SunOS eddoe 5.5 Generic sun4m sparc SUNW,SPARCstation-10
eddoe:~/tmp$ 
-------->8--------
This also demonstrates the continued wrong-ness of the default time zone for a DateFormat, 
and what I believe to be a currently correct way of making a suitable TimeZone for the UK.


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

Comments
WORK AROUND Name: joT67522 Date: 10/13/97 The SimpleTimeZone constructed in the sample code is correct for the last couple of years. ======================================================================
11-06-2004