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

Wrong SimpleDateFormat behavior with Japanese Imperial Calendar

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      I have tested New Era for Japanese Imperial Calendar.
      In Java 8, the letter "G" indicates a short or abbreviated form like "H" (for Heisei Era).
      But, after Java 9 (through 12-ea), the letter "G" indicates the full form like "平成".

      REGRESSION : Last worked in version 8u192

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute below source code with JShell

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      H31.01.04
      ACTUAL -
      平成31.01.04

      ---------- BEGIN SOURCE ----------
      import java.text.*;
      Locale locale = new Locale("ja", "JP", "JP");
      DateFormat alphabetFormat = new SimpleDateFormat("Gyy.MM.dd", locale);
      Calendar now = Calendar.getInstance(locale);
      System.out.println(alphabetFormat.format(now.getTime()));

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

      FREQUENCY : always


            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: