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

Wrong dateformat for locale es_DO

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 7u21, 9
    • globalization
    • b15
    • generic
    • generic
    • Verified

        FULL PRODUCT VERSION :
        java version "1.7.0_21"
        Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
        Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Tested on ubuntu/linux 10.04 and earlier
        macosx 10.6 and earlier

        A DESCRIPTION OF THE PROBLEM :
        The locale es_DO from your implementation, produces a DateFormat as month, day and year. This is not the date format use in the Dominican Republic it is day, month and year.

        ADDITIONAL REGRESSION INFORMATION:
        It seems that this is an old bug.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Write a code:

        Locale esDO = new Locale("es", "DO");
        DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT, esDO);
        Calendar cal = Calendar.getInstance(esDO);
        cal.set(Calendar.DAY_OF_MONTH, 31);
        cal.set(Calendar.MONTH, Calendar.MARCH);
        cal.set(Calendar.YEAR, 2012);
        System.out.println(esDO + " - " + format.format(cal.getTime()));


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        es_DO - 31/03/12
        ACTUAL -
        es_DO - 03/31/12

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        No error messages

        REPRODUCIBILITY :
        This bug can be reproduced always.

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

        public class ATest {
        public static void main(String[] args) throws Exception {
        Locale esDO = new Locale("es", "DO");
        DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT, esDO);
        Calendar cal = Calendar.getInstance(esDO);
        cal.set(Calendar.DAY_OF_MONTH, 31);
        cal.set(Calendar.MONTH, Calendar.MARCH);
        cal.set(Calendar.YEAR, 2012);
        System.out.println(esDO + " - " + format.format(cal.getTime()));
        }
        }

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

              mfang Michael Fang (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: