Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## YEAR function

> Evaluates a date expression and returns the year value of that date, including the century.

> #### Syntax

>     YEAR ( date )

>     YEAR ( datetime-expression )

> ``date``

> A date expression for which you want to determine the year.

> ``datetime-expression``

> An expression that evaluates to a DATETIME or DATETIME-TZ. The YEAR function returns the year of the date part of the DATETIME or DATETIME-TZ value.

> 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.
>     DEFINE VARIABLE orddate AS CHARACTER
>       LABEL "Order Date" FORMAT "x(10)".

>     FOR EACH order:
>       IF YEAR(odate) >= 2000
>       THEN outfmt = "99/99/9999".
>       ELSE outfmt = "99/99/99".
>       orddate = STRING(odate,outfmt).
>       DISPLAY order.order-num orddate terms.
>     END.

> #### See also

> YEAR-OFFSET attribute

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095