United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4441535 : Number of digits for 'year' in DateFormat.MEDIUM changes with Locale

Details
Type:
Bug
Submit Date:
2001-04-12
Status:
Resolved
Updated Date:
2004-09-25
Project Name:
JDK
Resolved Date:
2001-08-08
Component:
globalization
OS:
generic
Sub-Component:
translation
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.3.0
Fixed Versions:
1.4.0 (beta2)

Related Reports

Sub Tasks

Description

Name: boT120536			Date: 04/12/2001


java version "1.3.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)

The number of digits used to display the year and the way the month is
displayed in the DateFormat.MEDIUM format changes with the Locale used, some
Locales show the year as '2001' others as '01' some display the month as '04'
others using abbriviation. This seems to be related to the problem described in
bug 4175300 where sun promises to change the MEDIUM format to use 4 digits for
year, it seems this is only true for some countries/languages.

The following code prints a list of MEDIUM formatted dates for every available
locale:

    Locale[] allLocales = Locale.getAvailableLocales();
    for (int i = 0; i < allLocales.length; i++) {
        SimpleDateFormat sdf
            = (SimpleDateFormat) DateFormat.getDateInstance(
                    DateFormat.MEDIUM, allLocales[i]);
        System.out.println(allLocales[i].getDisplayName()
             + " \t\t\t " +  sdf.format(new Date()));
    }

Some of the output looks like this (cut to show some variations):

English 			 Apr 12, 2001
English (United States) 			 Apr 12, 2001
(..)
English (Canada) 			 12-Apr-01
(..)
Icelandic (Iceland) 			 12.4.2001
Chinese (Taiwan) 			 2001/4/12

This feature does not give me much trouble, but I feel very stupid telling my
users to change their language/country setting from Dutch/Netherlands to
English/US to display years in a y2k-save manner.
(Review ID: 120661) 
======================================================================

                                    

Comments
EVALUATION


karl.hong@eng 2001-07-12

I am going to update "medium date pattern" to have 'yyyy' for year in LocaleElement for all locales.
                                     
2001-07-12
WORK AROUND



Name: boT120536			Date: 04/12/2001


Setting your locale to one of the happy '4-digit-year' countries and learn the
language.
======================================================================
                                     
2004-09-26
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
merlin-beta2

FIXED IN:
merlin-beta2

INTEGRATED IN:
merlin-beta2


                                     
2004-09-26



Hardware and Software, Engineered to Work Together