A reference to the DateTime (this).
auto dt1 = DateTime(2010, 1, 1, 11, 23, 12); dt1.roll!"days"(1); assert(dt1 == DateTime(2010, 1, 2, 11, 23, 12)); dt1.roll!"days"(365); assert(dt1 == DateTime(2010, 1, 26, 11, 23, 12)); dt1.roll!"days"(-32); assert(dt1 == DateTime(2010, 1, 25, 11, 23, 12)); auto dt2 = DateTime(2010, 7, 4, 12, 0, 0); dt2.roll!"hours"(1); assert(dt2 == DateTime(2010, 7, 4, 13, 0, 0)); auto dt3 = DateTime(2010, 1, 1, 0, 0, 0); dt3.roll!"seconds"(-1); assert(dt3 == DateTime(2010, 1, 1, 0, 0, 59));
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".