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

Short time format incorrect for English (South Africa)

XMLWordPrintable

      FULL PRODUCT VERSION :
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
      Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 5.2.3790]

      A DESCRIPTION OF THE PROBLEM :
      The short time format for English (South Afica) is hh:mm. How can it be 12 hours without am/pm?

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the following codes:

              String [] countries = {"ie", "gb", "zw", "ph", "za", "us", "au", "bz", "ca", "jm", "nz", "tt", ""};
              
              for (int i = 0; i < countries.length; i++)
              {
                  Locale lo = new Locale ("en", countries[i]);
                  DateFormat tf = SimpleDateFormat.getTimeInstance(DateFormat.SHORT, lo);
                  if (tf != null)
                  {
                      String pattern = ((SimpleDateFormat)tf).toPattern();
                      System.out.println ("Locale is " + lo.getDisplayLanguage () + "(" + lo.getDisplayCountry () + "). Pattern is " + pattern);
                  }
                  
              }

      The results are :

      Locale is English(Ireland). Pattern is HH:mm
      Locale is English(United Kingdom). Pattern is HH:mm
      Locale is English(Zimbabwe). Pattern is h:mm a
      Locale is English(Philippines). Pattern is h:mm a
      Locale is English(South Africa). Pattern is hh:mm
      Locale is English(United States). Pattern is h:mm a
      Locale is English(Australia). Pattern is HH:mm
      Locale is English(Belize). Pattern is h:mm a
      Locale is English(Canada). Pattern is h:mm a
      Locale is English(Jamaica). Pattern is h:mm a
      Locale is English(New Zealand). Pattern is HH:mm
      Locale is English(Trinidad and Tobago). Pattern is h:mm a
      Locale is English(). Pattern is h:mm a


      The pattern of English (South Africa) is hh:mm.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I check the Windows Regional settings, the English (South Africa) is 12 hours with am/pm.

      Locale is English(South Africa). Pattern is h:mm a

      ACTUAL -
      Locale is English(South Africa). Pattern is hh:mm


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
              String [] countries = {"ie", "gb", "zw", "ph", "za", "us", "au", "bz", "ca", "jm", "nz", "tt", ""};
              
              for (int i = 0; i < countries.length; i++)
              {
                  Locale lo = new Locale ("en", countries[i]);
                  DateFormat tf = SimpleDateFormat.getTimeInstance(DateFormat.SHORT, lo);
                  if (tf != null)
                  {
                      String pattern = ((SimpleDateFormat)tf).toPattern();
                      System.out.println ("Locale is " + lo.getDisplayLanguage () + "(" + lo.getDisplayCountry () + "). Pattern is " + pattern);
                  }
                  
              }

      The results are :

      Locale is English(Ireland). Pattern is HH:mm
      Locale is English(United Kingdom). Pattern is HH:mm
      Locale is English(Zimbabwe). Pattern is h:mm a
      Locale is English(Philippines). Pattern is h:mm a
      Locale is English(South Africa). Pattern is hh:mm
      Locale is English(United States). Pattern is h:mm a
      Locale is English(Australia). Pattern is HH:mm
      Locale is English(Belize). Pattern is h:mm a
      Locale is English(Canada). Pattern is h:mm a
      Locale is English(Jamaica). Pattern is h:mm a
      Locale is English(New Zealand). Pattern is HH:mm
      Locale is English(Trinidad and Tobago). Pattern is h:mm a
      Locale is English(). Pattern is h:mm a

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

            jtusla Jiri Tusla (Inactive)
            okutsu Masayoshi Okutsu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: