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

UK Locale date/time details are wrong

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.3
    • core-libs



      Name: ggC50526 Date: 10/16/97


      The following code gives the wrong timezone name for
      summer dates, and often the wrong week number for the UK.

      -------------------------

      import java.lang.*;
      import java.io.*;
      import java.text.*;
      import java.util.*;

      public class DateTest {
      private static SimpleDateFormat date;
      public static void main(String[] args) {
      Locale.setDefault(Locale.UK);
      date=new SimpleDateFormat("dd MMM yyy (zzzz) 'is in week' ww");
      Calendar cal=Calendar.getInstance();
      Date now=cal.getTime();
      showdate(now);
      cal.set(1997,Calendar.JANUARY,1);
      now=cal.getTime();
      showdate(now);
      cal.set(1997,Calendar.JANUARY,8);
      now=cal.getTime();
      showdate(now);
      cal.set(1996,Calendar.DECEMBER,31);
      now=cal.getTime();
      showdate(now);
      }
      static void showdate(Date then) {
      System.out.println(date.format(then));
      }
      }

      --------------------
      This gives the output:

      30 Sep 1997 (British Standard Time) is in week 39
      01 Jan 1997 (Greenwich Mean Time) is in week 01
      08 Jan 1997 (Greenwich Mean Time) is in week 02
      31 Dec 1996 (Greenwich Mean Time) is in week 53

      "British Standard Time" hasn't been used as a timezone name
      since 1971. The daylight savings zonename for the UK is "British
      Summer Time".

      We use ISO8601 week numbers in the UK and (AFAIK) Europe (e.g.
      see "date +%V" in Solaris 2).
      30 Sep 1997 is in week 40, NOT week 39.
      31 Dec 1996 is in week 1 of 1997, NOT week 53 of 1996.
      It appears that the 'week number' is merely a count
      of the number of that weekday that have passed - this
      is not the week number as we in the UK understand it.
      ======================================================================

            aliusunw Alan Liu (Inactive)
            ggrahamsunw Gregory Graham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: