PreviousNextIndex

WEEKDAY function

Evaluates a date expression and returns the day of the week as an INTEGER value from 1 (Sunday) to 7 (Saturday) for that date.

Syntax

WEEKDAY ( date ) 

WEEKDAY ( datetime-expression ) 

date
datetime-expression
Example

This procedure tells you the day of the week that you were born and how many days old you are:

r-wkday.p
DEFINE VARIABLE birth-date AS DATE      NO-UNDO 
  LABEL "Birth Date". 
DEFINE VARIABLE daynum     AS INTEGER   NO-UNDO. 
DEFINE VARIABLE daylist    AS CHARACTER NO-UNDO FORMAT "x(9)" 
  INITIAL "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday". 
DEFINE VARIABLE dayname    AS CHARACTER NO-UNDO 
  LABEL "Day You Were Born". 
DEFINE VARIABLE daysold    AS INTEGER   NO-UNDO 
  LABEL "Days Since You Were Born". 
REPEAT: 
  SET birth-date. 
  ASSIGN 
    daynum  = WEEKDAY(birth-date) 
    dayname = ENTRY(daynum, daylist) 
    daysold = TODAY - birth-date. 
  DISPLAY dayname daysold. 
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 function, YEAR-OFFSET attribute


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex