|
||||||
|
Relate Components | RelateScript | BlueStep.js |
Arithmetic & Date/Time Operators
The arithmetic operators do simple mathematical operations that are familiar to most individuals. They work with numbers (Integer and Float) and are also used to do date math. For all of the arithmetic operators, if one of the input values is null the result will be null. Addition: + Addition also works with DateDiff values added to other DateDiff values, to Date values, to Time values and to DateTime values. If a DateDiff is added to a Date, the result is a Date. If a DateDiff is added to a Time, the result is a Time. For a DateTime, same rule applies. The result is a DateDiff only when a DateDiff is added to another DateDiff. The operands can be in either order and the result is the same. In other words, addition is commutative when doing date and time math. Subtraction: - Subtraction also works with DateDiff values subtracted from other DateDiff values, from Date values, from Time values and from DateTime values. If a DateDiff is subtracted from a Date, the result is a Date. If a DateDiff is subtracted from a Time, the result is a Time. For a DateTime, same rule applies. The result is a DateDiff only when a DateDiff is subtracted from another DateDiff. The DateDiff value must be the second operand; in other words, you cannot subtract a Date from a DateDiff, even though you can subtract a DateDiff from a Date. Finally, subtraction works with two Time values, two Date values or two DateTime values with the result being a DateDiff. This is where the term DateDiff comes from originally. You can subtract in either order, but the results will be different: one result will be the negative of the other. Negation: - Multiplication: * Multiplication also works with DateDiff values multiplied by Integer values or by Float values. The result is always a DateDiff. The operands can be in either order and the result is the same. In other words, multiplication is commutative when doing DateDiff math. Division: / Division also works with DateDiff values divided by Integer values or by Float values. The result is always a DateDiff. The DateDiff value must be the first operand, in otherwords, you cannot divide an Integer by a DateDiff even though you can divide a DateDiff by an Integer. Mod (Remainder): % |