Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : MONTH function
 

MONTH function

Evaluates a date expression and returns a month INTEGER value from 1 to 12, inclusive.

Syntax

MONTH ( date )
MONTH ( datetime-expression )
date
A date expression where you want a month value.
datetime-expression
An expression that evaluates to a DATETIME or DATETIME-TZ. The MONTH function returns the month of the date part of the DATETIME or DATETIME-TZ value.

Example

This procedure displays all the Orders that have a PromiseDate in a month that has passed, and whose ShipDate field is the Unknown value (?), which is the initial value of the ShipDate field:
r-mon.p
FOR EACH Order NO-LOCK:
  IF (MONTH(Order.PromiseDate) < MONTH(TODAY) OR
    YEAR(Order.PromiseDate) < YEAR(TODAY)) AND Order.ShipDate = ? THEN
    DISPLAY Order.OrderNum LABEL "Order Num" Order.PO LABEL "P.O. Num"
      Order.PromiseDate LABEL "Promised By"
      Order.OrderDate LABEL "Ordered" terms
      WITH TITLE "These orders are overdue".
END.

See also

ADD-INTERVAL function, DATE function, DATE-FORMAT attribute, DATETIME function, DATETIME-TZ function, DAY function, ETIME function, INTERVAL function, ISO-DATE function, MTIME function, NOW function, TIME function, TIMEZONE function, TODAY function, WEEKDAY function, YEAR function, YEAR-OFFSET attribute