JDK-4632590 : Make java.util.Calendar.JANUARY = 1
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2002-02-04
  • Updated: 2002-02-05
  • Resolved: 2002-02-05
Related Reports
Duplicate :  
Description
The 

java.util.Calendar.get (Calendar.MONTH) is used alongwith
Calendar.get (Calendar.YEAR) and
Calendar.get (Calendar.DATE).

While the other two results (Year and Date) are directly usable, since JANUARY to DECEMBER are enumerated from 0 to 11, an incrementation of get (MONTH) output is needed. 

This can be fixed without much of difficulty as it will help the users in ease of use.

Comments
WORK AROUND ( new Calendar()).get (Calendar.MONTH) + 1 would do the trick, but looks ugly.
11-06-2004

EVALUATION It's not possible to change those constants due to the binary compatibility. However, we plan to provide new calendar classes and use 1-based month numbers. See bug# 4340168 for new calendar classes. ###@###.### 2002-02-05
05-02-2002

SUGGESTED FIX Add a new method, String getMonth (), returning JANUARY, FEBRUARY etc.. if backward compatibility from JDK1.1 has to be maintained for the wrongly shipped method. Or Addition of two methods, int getMonth () String getMonthName () would do the trick ! ###@###.### 2002-02-04
04-02-2002