DayNumber

Description

Determines the day of the week of a date value and returns the number of the weekday.

Syntax

DayNumber ( date )

Argument

Description

date

The date value from which you want the number of the day of the week

Returns

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.

Examples

Example 1

These statements evaluate the date literal 2000-01-31 and set day_nbr to 4 (January 31, 2000, was a Wednesday):

integer day_nbr

day_nbr = DayNumber(2000-01-31)

Example 2

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

See also