Method Calendar.TimeRanges.TimeRange()->add()
- Method add
- Description
-
calculates the (promoted) time period n steps away; if no step is given, the step's length is of the same length as the called time period.
It is not recommended to loop by adding the increment time period to a shorter period; this can cause faults, if the shorter time period doesn't exist in the incremented period. (Like week 53, day 31 of a month or the leap day of a year.)
Recommended use are like this:
// loop over the 5th of the next 10 months TimeRange month=Month()+1; TimeRange orig_day=month()->day(5); for (int i=0; i<10; i++) { month++; TimeRange day=month->place(orig_day); <i>...use day...</i> }