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

Dateformats for Poland/Polish are wrong

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6u29
    • globalization

      FULL PRODUCT VERSION :
      JDK 6: 1.6.0.29
      JDK 7: 1.7.0

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP Professional SP3

      A DESCRIPTION OF THE PROBLEM :
      The dateformats both for polish and polish-Poland (pl/pl_PL) are wrong.

      Current formats from FormatData:

      FormatData_pl:
      "d MMMM yyyy", // long date pattern
      "yyyy-MM-dd", // medium date pattern
      "yy-MM-dd", // short date pattern

      FormatData_pl_PL:
      "d MMMM yyyy", // long date pattern
      "yyyy-MM-dd", // medium date pattern
      "dd.MM.yy", // short date pattern

      According to http://unicode.org/repos/cldr-tmp/trunk/diff/summary/pl.html the following format are correct:
      date-long: d MMMM y
      date-medium: d MMM y
      date-short: dd.MM.yyyy

      So the correct version in java-datestyle for both pl and pl_PL is:
      "d MMMM yyyy", // long date pattern
      "dd.MM.yyyy", // medium date pattern
      "dd.MM.yy", // short date pattern


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.text.DateFormat;
      import java.util.Date;
      import java.util.Locale;

      public class PlLocale {
      public static void main(String[] args) {
      testLocale(new Locale("pl", "PL"));
      testLocale(new Locale("pl"));
      }

      // prints the short/medium/long date format for the given locale
      private static void testLocale(Locale locale) {
      System.out.format("--- %s ---\n", locale.getDisplayName());

      // wrong for pl, correct for pl_PL
      DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
      System.out.println(df.format(new Date()));

      // wrong for pl and pl_PL
      df = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
      System.out.println(df.format(new Date()));

      // correct
      df = DateFormat.getDateInstance(DateFormat.LONG, locale);
      System.out.println(df.format(new Date()));
      }
      }
      ---------- END SOURCE ----------

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

              Created:
              Updated:
              Resolved:
              Imported: