JDK-4086724 : UK Locale date/time details are wrong
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.1.3
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 1997-10-16
  • Updated: 1998-02-24
  • Resolved: 1998-02-24
Related Reports
Duplicate :  
Description

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.
======================================================================

Comments
WORK AROUND Name: ggC50526 Date: 10/16/97 None known ======================================================================
11-06-2004