Try OpenEdge Now
skip to main content
ABL Data Types Addenda
DATETIME and DATETIME-TZ data types : Datetime arithmetic : Adding and subtracting basic datetime values
 

Adding and subtracting basic datetime values

You can use the addition (+) and subtraction (-) operators with datetime values to obtain results that are defined according to the operation and its operands. So, with the addition operator, you can add milliseconds to a datetime value using the following syntax:

Syntax

new-datetime = old-datetime + milliseconds
new-datetime-tz = old-datetime-tz + milliseconds
The result is a different DATETIME or DATETIME-TZ value, respectively.

Syntax

With the subtraction operator, you can subtract milliseconds from a datetime value or subtract a compatible datetime value from a another datetime value using the following syntax:
result = datetime - {milliseconds|datetime }
result = datetime-tz - {milliseconds|datetime-tz }
The result is either a different DATETIME or DATETIME-TZ value (when subtracting milliseconds) or a millisecond interval between two DATETIME or DATATIME-TZ values returned as an INT64.