Logo Search packages:      
Sourcecode: icu version File versions  Download package

void Calendar::roll ( UCalendarDateFields  field,
UBool  up,
UErrorCode status 
) [inline, inherited]

Time Field Rolling function. Rolls (up/down) a single unit of time on the given time field. For example, to roll the current date up by one day, call roll(Calendar::DATE, true). When rolling on the year or Calendar::YEAR field, it will roll the year value in the range between getMinimum(Calendar::YEAR) and the value returned by getMaximum(Calendar::YEAR). When rolling on the month or Calendar::MONTH field, other fields like date might conflict and, need to be changed. For instance, rolling the month up on the date 01/31/96 will result in 02/29/96. Rolling up always means rolling forward in time; e.g., rolling the year up on "100 BC" will result in "99 BC", for Gregorian calendar. When rolling on the hour-in-day or Calendar::HOUR_OF_DAY field, it will roll the hour value in the range between 0 and 23, which is zero-based.

NOTE: Do not use this method -- use roll(UCalendarDateFields, int, UErrorCode&) instead.

Parameters:
field The time field.
up Indicates if the value of the specified time field is to be rolled up or rolled down. Use true if rolling up, false otherwise.
status Output param set to success/failure code on exit. If any value previously set in the time field is invalid or restricted by leniency, this will be set to an error status. ICU 2.6.

Definition at line 2152 of file calendar.h.

References Calendar::roll().

{
    roll(field, (int32_t)(up ? +1 : -1), status);
}


Generated by  Doxygen 1.6.0   Back to index