DateTimeArithmeticExtensions extension

Extensions on DateTime for add, subtract, and difference operations.

on

Methods

addDays(int days) DateTime

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Adds the specified number of days to the current DateTime.
addHours(int hours) DateTime

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Adds the specified number of hours to the current DateTime.
addMinutes(int minutes) DateTime

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Adds the specified number of minutes to the current DateTime.
addMonths(int months) DateTime

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Adds the specified number of months to the current DateTime.
addYears(int years) DateTime

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Adds the specified number of years to the current DateTime.
getTimeDifferenceMs(DateTime? compareTo, {bool isAlwaysPositive = true}) int?

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Returns the time difference in milliseconds between this DateTime and compareTo, or null if compareTo is null.
subtractDays(int? days) DateTime

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Subtracts the specified number of days from the current DateTime.
subtractHours(int hours) DateTime

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Subtracts the specified number of hours from the current DateTime.
subtractMinutes(int minutes) DateTime

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Subtracts the specified number of minutes from the current DateTime.
subtractMonths(int months) DateTime

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Subtracts the specified number of months from the current DateTime.
subtractYears(int years) DateTime

Available on DateTime, provided by the DateTimeArithmeticExtensions extension

Subtracts the specified number of years from the current DateTime.