Progress
Language Reference


YEAR Function

Interfaces
OS
SpeedScript
All
All
Yes

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

SYNTAX

YEAR ( date ) 

date

A date expression that you want to determine the year for.

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

DAY Function, MONTH Function, WEEKDAY Function


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