Document directory
Do not read the JDK document.
In the original sense, roll can directly handle date changes. No. Check the JDK documentation as follows:
Roll
public void roll(int field, int amount)
-
Time Field Rolling function. add to field a signed amount without changing larger fields. A negative roll amount means to roll down. [Note: this default implementation on calendar just repeatedly cballs the version of roll () that takes a Boolean and rolls by one unit. this may not always do the right thing. for example, if the day_of_month field is 31, rolling through February will leave it set to 28. the gregoriancalendar version of this function takes care of this problem. other subclasses shoshould also provide overrides of this function that do the right thing.
-
-
-
Parameters:
-
field-The time field.
-
amount-The signed amount to add field.
-
Since:
-
1.2
-
See also:
-
add(int, int), set(int, int)
Shit, you should use add