Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : - Date subtraction operator
 

- Date subtraction operator

Subtracts a number of days from a date to produce a date result, or subtracts one date from another to produce an INTEGER result that represents the number of days between the two dates.

Syntax

date - { days | date }
date
An expression that evaluates to a DATE value.
days
An expression with a value of the number of days you want to subtract from date.

Example

This procedure finds all unshipped orders. If the promised date is more than one week ago, the procedure finds the customers who placed the order and displays the order and customer data.
r-dsub.p
DISPLAY "ORDERS SCHEDULED TO SHIP MORE THAN ONE WEEK LATE".
FOR EACH Order NO-LOCK WHERE Order.ShipDate = ?:
IF (TODAY - 7) > Order.PromiseDate THEN
    DISPLAY Order.OrderNum Order.CustNum Order.PromiseDate
  (TODAY - Order.PromiseDate) LABEL "Days Late".
END.

See also

+ Date addition operator, - Datetime subtraction operator, ADD-INTERVAL function, DATE function, INTERVAL function