@CaseyLOVESjava said:
actually it's not doing at all what it says it will. you are supposed to be able to set any one of the values specifically be it day date month year whatever. calendar.getinstance returns a calendar initialized to the current date and time. what i want to do is increment or decrement the month. so when i set Calendar.MONTH to a number, it should work. and in fact it does work for every case except february. so, nice try to make me look foolish, but you failed.
Actually, I think he did quite a good job.
If you actually read the JavaDocs for the Calendar, you'll find this, quite close to the top:
Leniency
Calendar
has two modes for interpreting the calendar
fields, lenient and non-lenient. When a
Calendar
is in lenient mode, it accepts a wider range of
calendar field values than it produces. When a Calendar
recomputes calendar field values for return by get()
, all of
the calendar fields are normalized. For example, a lenient
GregorianCalendar
interprets MONTH == JANUARY
,
DAY_OF_MONTH == 32
as February 1.