United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6386647 Full date format in DateFormat does not include day of the week for UK locale
JDK-6386647 : Full date format in DateFormat does not include day of the week for UK locale

Details
Type:
Bug
Submit Date:
2006-02-16
Status:
Resolved
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2006-08-18
Component:
globalization
OS:
linux
Sub-Component:
translation
CPU:
x86
Priority:
P5
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Relates:

Sub Tasks

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

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
                                     
2006-03-30
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.
                                     
2006-08-08



Hardware and Software, Engineered to Work Together