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

Calendar.set() for WEEK_OF_MONTH & WEEK_OF_YEAR have problems in "ar" locale

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.1, 1.4.0
    • core-libs
    • None
    • beta
    • generic
    • generic

      Calendar.getTime() or get() returns wrong value in "ar" locales
      after Calendar.set(Calendar.WEEK_OF_YEAR) or set(Calendar.WEEK_OF_MONTH)
      is used.

      For example,
          Calendar c = Calendar.getInstance();
          c.set(Calendar.YEAR, 1997);
          c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
          c.set(Calendar.MONTH, Calendar.JUNE);
          c.set(Calendar.WEEK_OF_MONTH, 1);
        c.getTime() returns May 27, 1997. (Expected date is Jun 3, 1997)

          Calendar c = Calendar.getInstance();
          c.set(Calendar.YEAR, 1997);
          c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
          c.set(Calendar.WEEK_OF_YEAR, 1);
        c.getTime() returns Dec 24, 1996. (Expected date is Dec 31, 1996).

      On the other hand,
          Calendar c = Calendar.getInstance();
          c.set(Calendar.YEAR, 1997);
          c.set(Calendar.MONTH, Calendar.MAY);
          c.set(Calendar.DATE, 27);
        c.get(Calendar.WEEK_OF_MONTH) returns 5. (This is correct.)
        c.get(Calendar.WEEK_OF_YEAR) returns correct value as well.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: