Add and subtract operations

This table shows the valid combinations of types when the operator is + or -. To understand the calculation of the expression A + B, find the intersection of the row for A's type and the column for B's type. Consult the numbered notes for the details of casting or conversion.

  DateTime Date Time of Day Integer Decimal Double True or False Other (text)
                 
DateTime 3 3 3 5 5 5 X 1
Date X 3 4 5 5 5 X 1
Time of Day X 4 3 X 5 5 X 1
Integer 5 5 X 2 2 2 X 1
Decimal 5 5 5 2 2 2 X 1
Double 5 5 5 2 2 2 X 1
True or False X X X X X X X 1
Other (text) 1 1 1 1 1 1 1 1

X indicates that a casting, promotion or conversion is not supported. The Pega Platform reports an error.

  1. For +, performs Java String concatenation (result is of mode Single Value ). The minus operator ( - ) is not permitted.
  2. Converts Integer > Double > Decimal until both operands have same type, then perform operation. Result is of the promoted type. (Converts directly to the target type without performing intermediate conversions.)
  3. The + operator is not permitted. The - operator converts operands to Decimal and performs the operation, yielding Decimal number of days and fraction of day.
  4. The + operator converts operands to Decimal and performs the operation, yielding a DateTime with GMT assumed. The - operator is not permitted.
  5. Converts operands to Decimal and performs the operation, yielding a Date (rounded), Time of Day or DateTime (depending upon type of original non-numeric operand)