JDK-4441535 : Number of digits for 'year' in DateFormat.MEDIUM changes with Locale
  • Type: Bug
  • Component: globalization
  • Sub-Component: translation
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2001-04-12
  • Updated: 2004-09-25
  • Resolved: 2001-08-08
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.
1.4.0 beta2Fixed

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[] allLocales = Locale.getAvailableLocales();
    for (int i = 0; i < allLocales.length; i++) {
        SimpleDateFormat sdf
            = (SimpleDateFormat) DateFormat.getDateInstance(
                    DateFormat.MEDIUM, allLocales[i]);
             + " \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) 

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta2 FIXED IN: merlin-beta2 INTEGRATED IN: merlin-beta2

WORK AROUND Name: boT120536 Date: 04/12/2001 Setting your locale to one of the happy '4-digit-year' countries and learn the language. ======================================================================

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.