{{sidenavigation.sidenavigationExpandLabel}}
{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}} {{helpModel.downloadHelpPdfDataStatus}}

Operator "+"

This operator "adds" the two operands and returns the result. Depending on the value types of the two operands, the value type of the result can be the same as one of the two operands or even a completely different value type, as in the case of a date plus a time, which returns a datetime.

Note the special meaning of the "+" operator in connection with dates:

  • date + number is equivalent to adding a certain number of days to the date (very similar to the DateAdd function)
  • datetime + number is also equivalent to adding a certain number of days to the date (very similar to the DateAdd function)
  • time + number is equivalent to adding a certain number of seconds to the time (similar to the DateAdd function using seconds as the parameter)

Usage:

number1 + number2   // Returns number
number + currency   // Returns currency
time + number       // Returns time
date + time         // Returns datetime
date + number       // Returns date
datetime + time     // Returns datetime
datetime + number   // Returns datetime
time + number       // Returns time
string1 + string2   // Returns string

Returns:

depends on operand value types

Examples (Same in Basic and Crystal syntax):

21 + 21                                   // Returns 42
21 + $21                                  // Returns $42
time(12,00,00) + 73	                    // Returns 12:01:13
date(2005,12,12) + time(5,5,5)            // Returns 12/12/2005, 5:05:05 a.m.
date(2005,12,12) + 42                     // Returns 1/23/2006
datetime(2005,12,12,5,5,5) + time(5,5,5)  // Returns 12/12/2005, 10:10:10 a.m.
datetime(2005,12,12,5,5,5) + 42           // Returns 1/23/2006, 5:05:05 a.m.
"this is" + " a test"                     // Returns "this is a test"

See also:

SEP IT AG
sep.ch verwendet Cookies und ähnliche Technologien, um das Nutzererlebnis auf unserer Webseite zu verbessern und unseren Datenverkehr zu analysieren. Mehr Informationen in unserer Datenschutzerklärung


Help - Add operator