Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8017142

Time display for Spanish(Chile, Ecuador ) locale doesn't show 24-hour format

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 6u29
    • Fix Version/s: 9
    • Component/s: globalization
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b04
    • CPU:
      x86
    • OS:
      windows_xp

      Backports

        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 ----------

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                yhuang Yong Huang (Inactive)
                Reporter:
                peytoia Yuka Kamiya (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported: