WEEKDAY( ) operator returns a positive integer that corresponds to the day of the week of its operand.
WEEKDAY() operator takes a DATE or DATETIME operand and returns an INTEGER value in the range from 0 to 6 where 0 stands Sunday, 1 stands for Monday, and so on:
DISPLAY "Today is ", WEEKDAY(my_date)
This operator is useful for determining days of weeks from past and future years.
This example program gives you a simple example of how the WEEKDAY() operator can be used:
MAIN
DEFINE my_date DATE
LET my_date = "09/28/1066"
DISPLAY "It was day#", trim(WEEKDAY(my_date)), " of the week."
END MAIN
The example program, weekday_01_name, shows how to return the name of the weekday using the WEEKDAY() operator.
The example program, weekday_02_definite, shows how to get a weekday for a date enter by the user.
The USING operator can also return day-of-the-week information from a DATE operand.