JDK-8017142 : Time display for Spanish(Chile, Ecuador ) locale doesn't show 24-hour format
  • Type: Bug
  • Component: globalization
  • Sub-Component: locale-data
  • Affected Version: 6u29
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2012-01-24
  • Updated: 2014-07-29
  • Resolved: 2014-02-27
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.
JDK 8 JDK 9
8u20Fixed 9 b04Fixed
Description
FULL PRODUCT VERSION :
JRE 1.6.0_29-b11 Java HotSpot(TM) Client VM

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
DateFormat.getDateTimeInstance() and DateFormat.getTimeInstance() methods are not displaying time in 24 hour clock format and instead display time in 12 hour format for Spanish(Chile) locale. Spanish(chile) locale uses 24 hour time format "H:mm:ss". This bug is seen in some more locales like Quechua(Ecuador).



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Change the Control Panel -> Regional and Language settings to "Spanish(Chile)" and run the following code using runtime arguments as "es" "CL"


class TestLocale
{
    public static final void main(String[] args)
    {
        Locale locale = new Locale(args[0], args[1]);

        DateFormat dateTimeInstance = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.MEDIUM, locale);
        DateFormat timeInstance = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale);

        System.out.println("-----------Display in user input locale " + locale + " ----------------");
        System.out.println("dateTimeInstance = "+ dateTimeInstance.format(new Date()));
        System.out.println("timeInstance = "+ timeInstance.format(new Date()));


        Locale defaultLocale = Locale.getDefault();
        dateTimeInstance = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.MEDIUM, defaultLocale);
        
        timeInstance = DateFormat.getTimeInstance(DateFormat.MEDIUM, defaultLocale);
        System.out.println("-----------Display in System default locale " + defaultLocale + " ----------------");
        System.out.println("dateTimeInstance = "+ dateTimeInstance.format(new Date()));
        System.out.println("timeInstance = "+ timeInstance.format(new Date()));
                
    }


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
-----------Display in user input locale es_CL ----------------
dateTimeInstance = 24-01-12 18:15:49 PM
timeInstance = 18:15:49 PM
-----------Display in System default locale es_CL ----------------
dateTimeInstance = 24-01-12 18:15:49 PM
timeInstance = 18:15:49 PM



ACTUAL -
-----------Display in user input locale es_CL ----------------
dateTimeInstance = 24-01-12 06:15:49 PM
timeInstance = 06:15:49 PM
-----------Display in System default locale es_CL ----------------
dateTimeInstance = 24-01-12 06:15:49 PM
timeInstance = 06:15:49 PM

******************************************************************************

The same program run with Portuguese(Brazil) locale displays correct 24 hour format as below:

-----------Display in user input locale pt_BR ----------------
dateTimeInstance = 24/01/12 18:20:52
timeInstance = 18:20:52
-----------Display in System default locale pt_BR ----------------
dateTimeInstance = 24/01/12 18:20:52
timeInstance = 18:20:52




REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
class TestLocale
{
    public static final void main(String[] args)
    {
        Locale locale = new Locale(args[0], args[1]);

        DateFormat dateTimeInstance = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.MEDIUM, locale);
        DateFormat timeInstance = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale);

        System.out.println("-----------Display in user input locale " + locale + " ----------------");
        System.out.println("dateTimeInstance = "+ dateTimeInstance.format(new Date()));
        System.out.println("timeInstance = "+ timeInstance.format(new Date()));


        Locale defaultLocale = Locale.getDefault();
        dateTimeInstance = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.MEDIUM, defaultLocale);
        
        timeInstance = DateFormat.getTimeInstance(DateFormat.MEDIUM, defaultLocale);
        System.out.println("-----------Display in System default locale " + defaultLocale + " ----------------");
        System.out.println("dateTimeInstance = "+ dateTimeInstance.format(new Date()));
        System.out.println("timeInstance = "+ timeInstance.format(new Date()));
                
    }

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

Comments
Hi Tomas, The bug fix has been ported to 8u20. The sub-bug is https://bugs.openjdk.java.net/browse/JDK-8039036 http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/d3dcc74bc4a2 thanks, Yong
04-05-2014

I got information from Michael that it's still possible to integrate the fix into 8u20. I will try to port the fix in 8u20. thanks, Yong
28-03-2014

The feture freeze of 8u20 is April 1. It seems that I can not catch up with 8u20 for this fix. I will fix the bug in next normal update (8u40?). thanks,
28-03-2014

When will there be a backport for Java 8?
27-03-2014

I will fix the bug in Java 9 and then port it to 8 update. thanks.
20-01-2014

This issue also applies to Ecuador (es_EC)
13-12-2013

Yong, could you please help to triage the bug? Thx!
08-10-2013