다음을 통해 공유


GregorianCalendar.Roll(CalendarField, Boolean) Method

Definition

Adds or subtracts (up/down) a single unit of time on the given time field without changing larger fields.

[Android.Runtime.Register("roll", "(IZ)V", "GetRoll_IZHandler")]
public override void Roll (Java.Util.CalendarField field, bool up);
[<Android.Runtime.Register("roll", "(IZ)V", "GetRoll_IZHandler")>]
override this.Roll : Java.Util.CalendarField * bool -> unit

Parameters

field
CalendarField

the calendar field.

up
Boolean

indicates if the value of the specified calendar field is to be rolled up or rolled down. Use true if rolling up, false otherwise.

Attributes

Exceptions

if an invalid field is specified.

Remarks

Adds or subtracts (up/down) a single unit of time on the given time field without changing larger fields.

<em>Example</em>: Consider a GregorianCalendar originally set to December 31, 1999. Calling #roll(int,boolean) roll(Calendar.MONTH, true) sets the calendar to January 31, 1999. The YEAR field is unchanged because it is a larger field than MONTH.

Java documentation for java.util.GregorianCalendar.roll(int, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to