DateTime (this).DateTime roll(string units)(long value, AllowDayOverflow allowOverflow = AllowDayOverflow.yes) if (units == "years" || units == "months") ref @safe pure nothrow @nogcAdds the given number of years or months to this DateTime, mutating it. A negative number will subtract.
The difference between rolling and adding is that rolling does not affect larger units. Rolling a DateTime 12 months gets the exact same DateTime. However, the days can still be affected due to the differing number of days in each month.
Because there are no units larger than years, there is no difference between adding and rolling years.
units | The type of units to add ("years" or "months"). |
value | The number of months or years to add to this DateTime. |
allowOverflow | Whether the days should be allowed to overflow, causing the month to increment. |
DateTime (this).Adds the given number of units to this DateTime, mutating it. A negative number will subtract.
The difference between rolling and adding is that rolling does not affect larger units. For instance, rolling a DateTime one year's worth of days gets the exact same DateTime.
Accepted units are "days", "minutes", "hours", "minutes", and "seconds".
units | The units to add. |
value | The number of units to add to this DateTime. |
DateTime (this).DateTime roll(string units)(long value) if (units == "hours" ||
units == "minutes" ||
units == "seconds") ref @safe pure nothrow @nogcditto