java.lang.IllegalArgumentException: MONTH
Im getting the actual date and the two passed months with calendar
Does anybody know what it means that??
Showing a little bit of your code would certainly help.
--
Fred K
Without seeing your code I cannot be sure, but three thoughts occur to
me:
1 What parameter is the method that throws the exception expecting?
Check the Javadoc very carefully.
2 Does your code say "MONTH" or "Calendar.MONTH"?
3 MONTH values run from 0 (January) to 11 (December) which might not
be what you were expecting. You can also have 12 for Undecimber, but
not many people use that.
rossum
What method is causing the exception? what values are you passing to
it?
Note that in GregorianCalendar, January is month 0. In contrast, in
DateFormat, January is month 1.
--
Roedy Green Canadian Mind Products
http://mindprod.com
You encapsulate not just to save typing, but more importantly, to make it easy and safe to change the code later, since you then need change the logic in only one place. Without it, you might fail to change the logic in all the places it occurs.
The constant Calendar.JANUARY has a numeric value of 0.
If people use the API as intended, then the numeric
values does not matter - it is just an opaque indication of
a specific month.
To say that January is "month 0" is using the API the
wrong way.
Arne