JDK-6386647 : Full date format in DateFormat does not include day of the week for UK locale
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 5.0
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2006-02-16
  • Updated: 2011-02-16
  • Resolved: 2006-08-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other JDK 6
1.4.2_17-revFixed 1.4.2_18Fixed 6 b96Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
1.4.2_10, 5.0_06

ADDITIONAL OS VERSION INFORMATION :
Linux daffy 2.6.15-1-686 #1 Wed Jan 18 15:04:35 UTC 2006 i686 GNU/Linux


A DESCRIPTION OF THE PROBLEM :
The UK full format for UK locale dates does not include the day of the week.  I don't see why the US and Canada full formats should include the day of the week and not the UK one.  If I code the pattern by hand it works fine.  Unfortunatly as I am developing a J2EE web application (JBoss with Sun's JDK) I am using the locale provide by the broswer.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See code

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
UK full date pattern: EEEE, d MMMM yyyy
UK long date pattern: dd MMMM yyyy

US full date pattern: EEEE, MMMM d, yyyy
US long date pattern: MMMM d, yyyy

CA full date pattern: EEEE, MMMM d, yyyy
CA long date pattern: MMMM d, yyyy

UK full date: Tuesday, 7 February 2006
UK long date: 07 February 2006

US full date: Tuesday, February 7, 2006
US long date: February 7, 2006

CA full date: Tuesday, February 7, 2006
CA long date: February 7, 2006

By Hand: Tuesday, 7 February 2006

ACTUAL -
UK full date pattern: dd MMMM yyyy
UK long date pattern: dd MMMM yyyy

US full date pattern: EEEE, MMMM d, yyyy
US long date pattern: MMMM d, yyyy

CA full date pattern: EEEE, MMMM d, yyyy
CA long date pattern: MMMM d, yyyy

UK full date: 07 February 2006
UK long date: 07 February 2006

US full date: Tuesday, February 7, 2006
US long date: February 7, 2006

CA full date: Tuesday, February 7, 2006
CA long date: February 7, 2006

By Hand: Tuesday, 7 February 2006


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.GregorianCalendar;

class UKDateBug {

    public static void main (String argv[] ) {

        /*using explicit constant for locale*/
        DateFormat dfFullUK = DateFormat.getDateInstance(DateFormat.FULL, Locale.UK);
        DateFormat dfFullUS = DateFormat.getDateInstance(DateFormat.FULL, Locale.US);
        DateFormat dfFullCA = DateFormat.getDateInstance(DateFormat.FULL, Locale.CANADA);
        DateFormat dfLongUK = DateFormat.getDateInstance(DateFormat.LONG, Locale.UK);
        DateFormat dfLongUS = DateFormat.getDateInstance(DateFormat.LONG, Locale.US);
        DateFormat dfLongCA = DateFormat.getDateInstance(DateFormat.LONG, Locale.CANADA);
        GregorianCalendar now = new GregorianCalendar();

        System.out.println("UK full date pattern: " + ((SimpleDateFormat) dfFullUK).toPattern());
        System.out.println("UK long date pattern: " + ((SimpleDateFormat) dfLongUK).toPattern());
        System.out.println();
        System.out.println("US full date pattern: " + ((SimpleDateFormat) dfFullUS).toPattern());
        System.out.println("US long date pattern: " + ((SimpleDateFormat) dfLongUS).toPattern());
        System.out.println();
        System.out.println("CA full date pattern: " + ((SimpleDateFormat) dfFullCA).toPattern());
        System.out.println("CA long date pattern: " + ((SimpleDateFormat) dfLongCA).toPattern());
        System.out.println();
        System.out.println("UK full date: " + dfFullUK.format(now.getTime()));
        System.out.println("UK long date: " + dfLongUK.format(now.getTime()));
        System.out.println();
        System.out.println("US full date: " + dfFullUS.format(now.getTime()));
        System.out.println("US long date: " + dfLongUS.format(now.getTime()));
        System.out.println();
        System.out.println("CA full date: " + dfFullCA.format(now.getTime()));
        System.out.println("CA long date: " + dfLongCA.format(now.getTime()));

        SimpleDateFormat format = new SimpleDateFormat("EEEE, d MMMM yyyy", Locale.UK);
        System.out.println();
        System.out.println("By Hand: " + format.format(now.getTime()));
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Code the pattern by hand (see code) if you really must have a senstable UK format.  I am letting the incomplete full version stand.

Comments
EVALUATION By mistake I forgot to remove one "d". Correct FULL format according the report and CLDR is: "EEEE, d MMMM yyyy" Thanks to Yuriko for catching this.
08-08-2006

EVALUATION Fixing the j2se:src/share/classes/sun/text/resources/FormatData_en_GB.java ------- FormatData_en_GB.java ------- 41c41 < "dd MMMM yyyy", // full date pattern --- > "EEEE, dd MMMM yyyy", // full date pattern According the submitter request and CLDR: http://unicode.org/cldr/data/common/main/en_GB.xml
30-03-2006