PreviousNextIndex

YEAR function

Evaluates a date expression and returns the year value of that date, including the century, as an INTEGER value.

Syntax

YEAR ( date ) 

YEAR ( datetime-expression ) 

date
datetime-expression
Example

This procedure uses the YEAR function to determine if an Order date is in this century or the next, and then uses a different display format for each:

r-year.p
DEFINE VARIABLE outfmt  AS CHARACTER NO-UNDO. 
DEFINE VARIABLE orddate AS CHARACTER NO-UNDO  
  LABEL "Order Date" FORMAT "x(10)". 
FOR EACH Order NO-LOCK: 
  ASSIGN 
    outfmt  = IF YEAR(Order.OrderDate) >= 2000 THEN  
                "99/99/9999" ELSE "99/99/99" 
    orddate = STRING(Order.OrderDate, outfmt). 
  DISPLAY Order.OrderNum orddate Order.Terms. 
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, MONTH function, MTIME function, NOW function, TIME function, TIME-SOURCE attribute, TIMEZONE function, TODAY function, YEAR-OFFSET attribute


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex