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

API: remove calendar system assumptions from DateFormat/SimpleDateFormat

    XMLWordPrintable

Details

    • b48
    • generic
    • generic

    Description

      DateFormat/SimpleDateFormat doesn't support Buddhist Era with BuddhistCalendar in non-Thai locales. The following sample program demonstrates the problem.

      --
      import java.util.*;
      import java.text.*;

      public class FormatBuddhistCalendar {

          public static void main(String[] args) {
      Calendar cal = Calendar.getInstance(new Locale("th", "TH"));
      SimpleDateFormat fmt = new SimpleDateFormat("G yyyy.MM.dd", Locale.US);
      fmt.setCalendar(cal);
      System.out.println(fmt.format(new Date()));
          }
      }

      --
      Output:

      AD 2546.03.17

      The era must be "B.E.".

      ###@###.### 2003-03-17

      Attachments

        Issue Links

          Activity

            People

              okutsu Masayoshi Okutsu
              okutsu Masayoshi Okutsu
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: