CALCDATE allows us to calculate a date value that's been assigned to a date data type variable. The calculation is based on DateExpression that's been applied to a base date (reference date). If we don't specify BaseDateValue, the current system date is used as the default date. We can specify BaseDateValue either in the form of a variable of data type date or as a date constant.
The syntax for CALCDATE is as follows:
DateVariable := CALCDATE ( DateExpression [, BaseDateValue])
There are a number of ways in which we can build a DateExpression. The rules for the CALCDATE function, DateExpression, are similar to the rules for DateFormula, which are described in Chapter 3, Data Types and Fields.
If there is a CW, CM, CP, CQ, or CY (current week, current month, current period, current quarter, or current year, respectively) parameter in an expression, then the result will be evaluated based on the BaseDateValue. If we have more than one of these in our expression...