Class TIMESPAN


t1 = .timespan~fromHours(1)
t2 = t1 * 2
-- displays "01:00:00.000000 02:00:00.000000 03:00:00.000000"
say t1 t2 (t1 + t2)

Read Me - Common Public License V1.0 - Copyright Notice(©)

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 TimeSpan object. Depending on the operation, the [argument] be either a TimeSpan object, a DateTime object, or a number. See the description of the individual operations for details. The [arithmetic_operator] can be:

+ + method method+ Addition. If argument is a DateTime object, the TimeSpan is added to the DateTime object, returning a new DateTime instance. Neither the receiver TimeSpan or the argument DateTime object is altered by this operation. The TimeSpan may be either positive or negative. If argument is a TimeSpan object, the two TimeSpans are added together, and a new TimeSpan instance is returned. Neither the TimeSpan object is altered by this operation.
- - method method- Subtraction. The argument must be a TimeSpan object. The argument TimeSpan is subtracted from the receiver TimeSpan and a new TimeSpan instance is returned. Neither the TimeSpan object is altered by this operation.
* * method method* Multiplication. The argument must be a valid Rexx number. The TimeSpan is multiplied by the argument value, and a new TimeSpan instance is returned. The receiver TimeSpan object is not altered by this operation.
/ / method method/ Division. The argument must be a valid Rexx number. The TimeSpan is divided by the argument value, and a new TimeSpan instance is returned. The receiver TimeSpan object is not altered by this operation. The / operator and % produce the same result.
% % method method% Integer Division. The argument must be a valid Rexx number. The TimeSpan is divided by the argument value, and a new TimeSpan instance is returned. The receiver TimeSpan object is not altered by this operation. The / operator and % produce the same result.
// // method method// Remainder Division. The argument must be a valid Rexx number. The TimeSpan is divided by the argument value and the division remainder is returned as a new TimeSpan instance. The receiver TimeSpan object is not altered by this operation.
Prefix - methodprefix - The TimeSpan is negated, returning a new TimeSpan instance. The receiver TimeSpan is not altered by this operation.
Prefix + methodprefix + Returns a new instance of the TimeSpan object with the same time value.

Read Me - Common Public License V1.0 - Copyright Notice(©)