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

DateFormat in german locale returns wrong value for month march

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u40
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b57
    • CPU:
      x86_64
    • OS:
      windows_7
    • Verification:
      Verified

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_40"
        Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
        Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Windows 7 Professional Service Pack 1

        A DESCRIPTION OF THE PROBLEM :
        The java.text.DateFormat.format() method returns inconsistent values for months if the Date object comes from a Calendar with german Locale and a time value in March:
        For a pattern "MMM" the format is "Mrz"
        For a pattern "MMM yyyy" the format is "Mär 2015"


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        execute the provided class

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Mär
        Mär 2015

        or

        Mrz
        Mrz 2015

        ACTUAL -
        Mrz
        Mär 2015

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.text.SimpleDateFormat;
        import java.util.Calendar;
        import java.util.GregorianCalendar;
        import java.util.Locale;

        public class CalendarLocaleMarchBug {

        public static void printDate (Calendar c, String pattern) {
        SimpleDateFormat f = new SimpleDateFormat(pattern);
        f.setCalendar(c);
        String res1 = f.format(c.getTime());
        System.out.println(res1);
        }

        public static void main(String[] args) {
        Calendar c = new GregorianCalendar(Locale.GERMAN);
        c.set(2015,02,20);
        printDate(c,"MMM");
        printDate(c,"MMM yyyy");
        }

        }
        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  okutsu Masayoshi Okutsu
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: