Try OpenEdge Now
skip to main content
SQL Reference
SQL Reference : OpenEdge SQL Functions : MONTHS_BETWEEN
 

MONTHS_BETWEEN

Computes the number of months between two date values corresponding to the first and second arguments.

Syntax

MONTHS_BETWEEN ( date_expression, date_expression )

Notes

*The first and second arguments to the function must be of type DATE.
*The result is of type INTEGER.
*The result is negative if the date corresponding to the second argument is greater than that corresponding to the first argument.
*If any of the argument expressions evaluates to NULL, the result is NULL.

Example

This example illustrates the MONTHS_BETWEEN function:
SELECT MONTHS_BETWEEN (SYSDATE, order_date)
    FROM orders
    WHERE order_no = 1002 ;

Compatibility

Progress extension