Date Math
One of the ways you can manipulate date fields is with date math. Date values are just like numbers in that you can add and subtract them.
Here are some common examples of date math:
-
Yesterday can be calculated by Today - 1.
-
Tomorrow can be calculated by Today + 1.
-
Days between dates can be calculated by <Date2> - <Date1>.
-
Days between Today and a future date can be calculated by <Date> - Today.
-
Days between Today and a past date can be calculated by Today - <Date>.
-
The number of days a matter has been open can be calculated by Today - Opened.
-
The number of days between when a matter was opened and closed can be calculated by Closed - Opened.
WARNING: An empty (or null) date is translated to zero in date math, so it presents a problem in date math calculations. For example, in the Closed - Opened calculation, if either Closed or Opened has no value set, the result is a useless very high (or very low) number. Keep this in mind if you create a report that uses date math. Either filter the date to only access records with valid date entries or create a more complex expression that checks for empty fields.