Determines the day of the week of a date value and returns the number of the weekday.
DayNumber ( date )
Argument |
Description |
---|---|
date |
The date value from which you want the number of the day of the week |
Integer. Returns an integer (1-7) representing the day of the week of date. Sunday is day 1, Monday is day 2, and so on. If date is null, DayNumber returns null.
These statements evaluate the date literal 1990-01-31 and set day_nbr to 4 (January 31, 1990, was a Wednesday):
integer day_nbr
day_nbr = DayNumber(1990-01-31)
These statements check to be sure the date in sle_date is valid, and if so set day_nbr to the number of the day in the sle_date:
integer day_nbr
IF IsDate(sle_date.Text) THEN
day_nbr = DayNumber(Date(sle_date.Text))
ELSE
MessageBox("Error", &
"This date is invalid: " &
+ sle_date.Text)
END IF