Arithmetic Methods >>-arithmetic_operator(argument)------------------------------->< Note For the prefix + operators, omit the parentheses and [argument] . Returns the result of performing the specified arithmetic operation on the receiver DateTime object. Depending on the operation, the [argument] be either a TimeSpan object or a DateTime object. See the description of the individual operations for details. The [arithmetic_operator] can be: | |
+ + method method+ | Addition. Adds a TimeSpan to the DateTime object, returning a new DateTime instance. The receiver DateTime object is not changed. The TimeSpan may be either positive or negative. |
- - method method- | Subtraction. If argument is a DateTime object, the two times are subtracted, and a TimeSpan object representing the interval between the two times is returned. If the receiver DateTime is less than the argument argument DateTime, a negative TimeSpan interval is returned. The receiver DateTime object is not changed. If argument is a TimeSpan object, subtracts the TimeSpan from the DateTime object, returning a new DateTime instance. The receiver DateTime object is not changed. The TimeSpan may be either positive or negative. |
Prefix - methodprefix - | A prefix - operation on a DateTime object will raise a SYNTAX error condition. |
Prefix + methodprefix + | Returns a new instance of the DateTime object with the same time value. |