Progress
Language Reference


WEEKDAY Function

Interfaces
OS
SpeedScript
All
All
Yes

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

SYNTAX

WEEKDAY ( date ) 

date

A date expression for which that you want the day of the week.

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

SEE ALSO

DATE Function, DAY Function, MONTH Function, YEAR Function


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