Arithmetic operators are used to perform arithmetic on numbers (or strings).
Operator | Description | Works with: |
+ | Addition | Numbers |
- | Subtraction | Numbers, Date |
* | Multiplication | Numbers |
/ | Division | Numbers |
% | Modulus | Numbers |
^ | Power | Number |
Return Values
Arithmetic Operators return either a NUMBER or DATE.
Notes
For numbers, the order in which they appear does not matter. For example;
3 + 2 = 5 will return the same as 2 + 3
With dates, only certain orders are allowed, for example;
Date + Number is valid, and number is treated as days.
Number + Date is not valid and will fail.
Date1 + Date2 is not valid and will fail.
Date1 – Date2 is valid and will return the number of days between Date1 and Date2 as a negative integer (assuming Date1 is chronologically earlier than Date2) .
Date2 – Date1 is valid and will return the number of days between Date1 and Date2 as a positive integer (assuming Date1 is chronologically earlier than Date2).
Date – Number is valid, and will return the date which precedes Date by the given Number of days.
Number – Date is not valid and will fail.
Example
Calculating overspend on a story that has attributes “Cost” and “Budget”
Cost-Budget
Finding an item’s duration in days
end-start
Returning the days of the week
(start-DATE(2019,11,20))%7
This calculation will return a value between 0 – 6, where 0 will be same day (for example, a Monday) as the date specified in the function. Then will return a 1 for a day which is the day after the function date, so if the function date was a Monday (every Monday following will return a 0), and the date returned was a Tuesday, the function will return a 1, or a 2 for a Wednesday and so on.