J2ME中的Calendar类,我使用 int month = calendar.get(Calendar.MONTH); 获取的月数总是少一个月 文档中也没有明确说月份从0开始的呀。 多谢各位高人!
A*o
2 楼
it is there. MONTH public static final int MONTH Field number for get and set indicating the month. This is a calendar- specific value. The first month of the year in the Gregorian and Julian calendars is JANUARY which is 0; the last depends on the number of months in a year.
A*o
3 楼
However, don't ask me why the other two fields are 1 based. IMHO, it's some very stupid designs on a core componet got carried over from start.